PHP 8 Attributes - the annotations of PHP

Code
<?php

#[Attribute]
class StrAttribute
{
    public function __construct(public string $value)
    {
    }
}

#[Attribute]
class IntAttribute
{
    public function __construct(public int $value)
    {
    }
}

#[StrAttribute('Class')]
#[IntAttribute(42)]
class Implementation
{
    #[StrAttribute('Method')]
    public function execute(): void
    {
    }
}

$reflectionClass = new ReflectionClass(Implementation::class);

foreach ($reflectionClass->getAttributes() as $attribute) {
    echo $attribute->newInstance()->value . PHP_EOL;
}

$reflectionMethod = $reflectionClass->getMethod('execute');

foreach ($reflectionMethod->getAttributes() as $attribute) {
    echo $attribute->newInstance()->value . PHP_EOL;
}
Result
Class
42
Method
Used Versions
PHP 8.3, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8