Skip to content

[Php81] Skip ArrayToFirstClassCallableRector on serialized callable array keys and Definition::setFactory()#8117

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-array-to-fcc-serialized-callable-keys
Jun 30, 2026
Merged

[Php81] Skip ArrayToFirstClassCallableRector on serialized callable array keys and Definition::setFactory()#8117
TomasVotruba merged 1 commit into
mainfrom
skip-array-to-fcc-serialized-callable-keys

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Skip ArrayToFirstClassCallableRector when the [$value, 'method'] array is meant to stay an array rather than become a first class callable:

  • array item keyed 'callback', 'factory', or 'validation_groups' — likely serialized to a callable string
  • argument of Symfony's \Symfony\Component\DependencyInjection\Definition::setFactory(), which does not accept a first class callable

Context is marked during parsing via a new AttributeKey::IS_ARRAY_AS_STRING_CALLABLE set in ContextNodeVisitor, then checked in the rule.

Covered by 4 new skip fixtures.

@TomasVotruba TomasVotruba merged commit 1ce7922 into main Jun 30, 2026
65 checks passed
@TomasVotruba TomasVotruba deleted the skip-array-to-fcc-serialized-callable-keys branch June 30, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant