Skip to content

fix: FunctionLikeToFirstClassCallableRector#7265

Merged
TomasVotruba merged 1 commit intorectorphp:mainfrom
calebdw:calebdw/push-wonpvszmkpyq
Sep 14, 2025
Merged

fix: FunctionLikeToFirstClassCallableRector#7265
TomasVotruba merged 1 commit intorectorphp:mainfrom
calebdw:calebdw/push-wonpvszmkpyq

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Sep 14, 2025

Hello!

I tried running this rule on my codebase, and there was a lot of breaks so this fixes those.

Additionally, I refactored the rule to remove duplication, improve readability, and make it more consistent with other rules (like adding a shouldSkip() method).

Thanks!

@calebdw calebdw force-pushed the calebdw/push-wonpvszmkpyq branch 2 times, most recently from e72bd72 to 988488c Compare September 14, 2025 05:46
@calebdw calebdw force-pushed the calebdw/push-wonpvszmkpyq branch from 988488c to 6b8de93 Compare September 14, 2025 05:50
@TomasVotruba
Copy link
Member

Looks good, thank you 💪🏻

@TomasVotruba TomasVotruba merged commit ecc0cf7 into rectorphp:main Sep 14, 2025
49 checks passed
Scope $scope
): bool {
$params = $node->getParams();
$args = $callLike->getArgs();
Copy link
Member

Choose a reason for hiding this comment

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

this ->getArgs() can't be moved too early calls, as it will cause assert error when already first class callable, see

https://github.com/nikic/PHP-Parser/blob/0da2d6679a3df45d6d720aa2e0d4568f82a32e46/lib/PhpParser/Node/Expr/CallLike.php#L32

, check firstClassCallable() first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix in a new PR

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants