[Php81][CodingStyle] Skip callable param assign with signature multi params on FunctionLikeToFirstClassCallableRector#7538
Conversation
…params on FunctionLikeToFirstClassCallableRector
|
Fixed 🎉 /cc @calebdw |
|
|
||
| (new SkipCallableParamAssignWithSignatureMultiParams()) | ||
| ->withTransform(fn (string $datum): string => trim($datum)) | ||
| ->run(' some data '); |
There was a problem hiding this comment.
@samsonasik, you should also test that this does convert to first class callable when both params are used:
function foo(mixed $datum, int|string|null $key) {}
(new SkipCallableParamAssignWithSignatureMultiParams())
- ->withTransform(fn ($datum, $key) => foo($datum, $key))
+ ->withTransform(foo(...))
->run(' some data ');There was a problem hiding this comment.
@calebdw I am going to skip for now :), this is already too complex to cover, the issue is not in the withTransform(), but on usage, as run() has default value, see original issue comment rectorphp/rector#9449 (comment)
There was a problem hiding this comment.
We should not care about the usage in run as long as the callable conforms to the signature that's specified on withTransform
There was a problem hiding this comment.
I prefer to only check multi params when dealing with native function, otherwise, skip for now, as that become hard to review changed code.
Fixes rectorphp/rector#9453
original: works: https://3v4l.org/SqOPO
changed: error https://3v4l.org/8kku6
Ref https://getrector.com/demo/371133f2-0c1c-4d0f-8e5c-958d89098e39