Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rector\Removing\Rector\ClassMethod\ArgumentRemoverRector::isArgumentValueMatch(): Argument #2 ($values) must be of type array, string given #6657

Closed
DanielSiepmann opened this issue Aug 25, 2021 · 5 comments · Fixed by rectorphp/rector-src#758
Labels

Comments

@DanielSiepmann
Copy link

DanielSiepmann commented Aug 25, 2021

Bug Report

Subject Details
Rector version rector/rector 0.11.49 Prefixed and PHP 7.1 downgraded version of rector/rector (invoke vendor/bin/rector --version -> Rector 7eb5e75cda2e0dc95198ec3841084792fac844fb)

Minimal PHP Code Causing Issue

https://getrector.org/demo/1ec056fc-11d4-6902-afc3-7bd57d99d6ca

Expected Behaviour

No error, as the example follows the docs. But the 'true' has to be ['true']. That at least removes the error, but keeps the original call. So I'm not able to configure the rule to actually remove the last argument.
I'm reporting this as bug instead of PR, as I expect tests to cover that, so something might be broken somewhere?

@TomasVotruba
Copy link
Member

TomasVotruba commented Aug 25, 2021

Hi, seems the fix is already clear:
https://github.com/rectorphp/rector/pull/6656/files

The docs in rule needs to be updated.

@DanielSiepmann
Copy link
Author

Yeah I've opened that as PR first, but noticed it is coming from docs.
But then I thought the docs are actually used to generate tests somehow?

I also encountered that adding [] still doesn't remove the argument as expected … So I still miss something important.

@DanielSiepmann
Copy link
Author

https://getrector.org/demo/1ec0570b-d66d-6fca-9e3a-cb9f01fd3936 results in no change, where I would expect last argument true to be removed.

@TomasVotruba
Copy link
Member

Maybe 'true' vs true?

@DanielSiepmann
Copy link
Author

Will provide a PR. Thanks for instant help. Dump me :)

echo511 pushed a commit to echo511/rector that referenced this issue Sep 4, 2021
The value to remove has to be enclosed as array.
The value also has to match the type. The example has a boolean `true`.
The example rule now matches that to prevent confusion.

Resolves: rectorphp#6657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants