[Php81] Drop Symfony PHP closure check from ArrayToFirstClassCallableRector - #8291
Merged
Merged
Conversation
…Rector The IS_ARG_NOT_ACCEPTING_CLOSURE union type check covers the Symfony config case precisely, based on the actual parameter type rather than on being anywhere inside a Symfony PHP config closure. Removes SymfonyClosureNodeVisitor and the IS_INSIDE_SYMFONY_PHP_CLOSURE attribute key, both of which had no other consumers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
IS_INSIDE_SYMFONY_PHP_CLOSUREcheck was a blunt instrument: it skipped every array callable anywhere inside a Symfony PHP config closure, regardless of what the array was passed to.Since #8288,
IS_ARG_NOT_ACCEPTING_CLOSUREdecides this from the actual parameter type - if the parameter cannot hold aClosure, the array callable is kept as is. That covers the Symfony config case precisely and, unlike the closure check, also works outside config files.return static function (ContainerConfigurator $container): void { - // previously skipped only because it sits inside a Symfony closure - $array = [$this, 'name']; + // now decided by the parameter type instead + $array = $this->name(...); };Removes, all now without consumers:
SymfonyClosureNodeVisitor(and itsrector-symfonySymfonyPhpClosureDetectordependency from core)AttributeKey::IS_INSIDE_SYMFONY_PHP_CLOSUREskip_symfony_config.php.incfixture - it asserted$container->services()->factory([...]), whichsymfony/dependency-injectionis not installed to resolve here; the union-type path is already covered byskip_union_array_param.php.incandskip_array_param.php.incDefinition::setFactory()remains covered by the name-basedIS_ARRAY_AS_STRING_CALLABLEcheck.