Remove NullToStrictStringFuncCallArgRector from the PHP 8.1 set - #8234
Merged
Conversation
The rule fires on a lot of call sites and is commonly skipped, so it costs more in withSkip() noise than it pays back when applied automatically. The rule itself and its 39 fixtures stay, so anyone who wants it can register it directly with withRules().
TomasVotruba
enabled auto-merge (squash)
July 30, 2026 21:24
rector.upgradeDowngradeRegisteredInSet requires every Php8x rule to be listed in its matching config set. Keeping this rule out of php81.php is deliberate, so scope the ignore to that one file rather than relaxing the rule.
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.
NullToStrictStringFuncCallArgRectorfires on a lot of call sites, and in practice it is commonly skipped rather than applied — so in the set it mostly generateswithSkip()entries.return static function (RectorConfig $rectorConfig): void { $rectorConfig->rules([ ... SpatieEnumMethodCallToEnumConstRector::class, - NullToStrictStringFuncCallArgRector::class, NullToStrictIntPregSlitFuncCallLimitArgRector::class,The rule and its 39 fixtures stay in place, so anyone who wants it can still opt in:
->withRules([NullToStrictStringFuncCallArgRector::class])Two things worth deciding on before merge
1.
withPhpLevel()positions shift.withPhpLevel(N)takes the firstN + 1rules in set-file order, so removing an entry fromphp81.phpshifts every later rule down by one. A config pinned at a given level will silently pick up whichever rule previously sat just past its cutoff. That is inherent to level-as-array-prefix and not specific to this rule, but it does mean this is not a no-op for level users.2. It still covers a real 8.1 deprecation. Passing
nullto a non-nullable internal function parameter is deprecated in 8.1, so dropping it from the set means an upgrade run no longer flags those call sites at all. If the goal is "stop applying it by default" rather than "stop offering it", an alternative is to leave it in the set but let it be skipped more easily — happy to switch to that if you prefer.I went with the straight removal since that is what was asked for.
Checks
ECS and PHPStan clean. The rule's own test suite still passes (39 tests) — nothing about the rule changed, only its set membership. Full suite matches the pre-existing baseline on
main.