Closed xepozz closed 1 year ago
Great idea, Dmitry. I gotta say I never faced this issue because I follow the prompt of the IDE to sort arguments, like a good boy :) I'll look into it.
@xepozz Could you try these changes? https://github.com/olvlvl/composer-attribute-collector/pull/8
I'll try them today or tomorrow
Unordered named arguments cause exception. It's better to dive into example.
Attribute:
So parameters order is:
Then let's take a look at the usage.
Class:
The dump:
The order is:
It's incorrect and won't work so
php
proves it:Caught unhandled error "App\RouteAttribute::__construct(): Argument #2 ($name) must be of type ?string, array given
I'd suggest to generate the dump asparameter name => value
, then the dump above will look like:If you do it array unpacking in
\olvlvl\ComposerAttributeCollector\Collection::forClass
will work correctly.