Skip to content

Conversation

@florisluiten
Copy link

Expected output and potential fix for issue with InvokableCommandInputAttributeRector

In PHP, optional parameters should be declared after required
parameters, otherwise they will be implicitly treated as required
parameters.
@TomasVotruba
Copy link
Member

@samsonasik Could you look into this?

@samsonasik
Copy link
Member

I will try

$executeClassMethod->params = array_merge(
array_filter($executeClassMethodParams, fn(Param $param) => is_null($param->default)),
array_filter($executeClassMethodParams, fn(Param $param) => !is_null($param->default)),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@florisluiten this seems cause errors in tests fixture, see

https://github.com/rectorphp/rector-symfony/actions/runs/20064007047/job/57548394124?pr=899

Please verify other expected output fixtures, you can test locally:

composer install
vendor/bin/phpunit

@TomasVotruba
Copy link
Member

@florisluiten I've updated the rule, so it can keep correct attribute per line formatting. Hopefully it will fix the comma issue.
Can you rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants