Skip to content

Deprecate FunctionArgumentDefaultValueReplacerRector in favor of dedicated rules - #8692

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-deprecate-function-argument-default-value-replacer
Oct 17, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-deprecate-function-argument-default-value-replacer

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follows up on the ReplaceArgumentDefaultValueRector deprecation (#8686) and extends the same idea to the function-call variant.

FunctionArgumentDefaultValueReplacerRector relies on weak, magic-value configuration. Inside rector-src it was only ever configured for two concrete PHP 8.0 cases, so those are replaced with explicit, type-safe rules:

  • VersionCompareFuncCallArgumentRector - normalizes the version_compare() operator aliases (gte -> ge, lte -> le, ''/! -> !=, g -> gt, l -> lt, n -> ne).
  • GetHeadersArgumentFormatRector - turns the integer associative argument of get_headers() into a boolean (0 -> false, 1 -> true).

Both are registered in php80 and php-version-based sets in place of the generic configured rule, and gate themselves via MinPhpVersionInterface (PHP 8.0).

The generic FunctionArgumentDefaultValueReplacerRector is deprecated the same way as #8686: it now implements DeprecatedInterface and throws, pointing users to a dedicated custom rule. Its old test fixtures are removed; the ReplaceFuncCallArgumentDefaultValue value object and ArgumentDefaultValueReplacer are kept and marked @api for backward compatibility.

…cated rules

Replace the generic configured usage in php80 and php-version-based sets with two explicit rules: VersionCompareFuncCallArgumentRector and GetHeadersArgumentFormatRector.
@TomasVotruba
TomasVotruba merged commit c66d933 into main Oct 17, 2026
48 of 49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-deprecate-function-argument-default-value-replacer branch October 17, 2026 19:23
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