I have an attribute as follow:
#[Attribute]
class State{
public function __constractor(
public string $name
){}
}
I want to add multiple states into my class as follow:
#[
State('a'),
State('b')
]
class StateMachine{}
Every thing is ok and I can access list of attributes as follow:
$attrs = $classReflection->getAttributes(State::class);
But the problem is, whenever I try to instant one of them, an error thrown:
$instance = $attrs[0]->newInstance();
The error is:
Error: Attribute "State" must not be repeated
Any Idea?