Skip to content

Remove AddOverrideAttributeToOverriddenMethodsRector from PHP 8.3 and polyfill sets - #8321

Merged
TomasVotruba merged 2 commits into
mainfrom
remove-override-attribute-from-set
Aug 8, 2026
Merged

Remove AddOverrideAttributeToOverriddenMethodsRector from PHP 8.3 and polyfill sets#8321
TomasVotruba merged 2 commits into
mainfrom
remove-override-attribute-from-set

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The rule adds #[Override] to every single overridden method. In practice that spams the codebase with attributes without bringing real value, so it should not run automatically as part of withPhpSets().

 class SomeChild extends SomeParent
 {
-    #[\Override]
     public function run()
     {
     }
 }

Changes:

  • removed from config/set/php83.php
  • removed from config/set/php-polyfills.php
  • dropped RelatedPolyfillInterface from the rule, as RegisterRelatedPolyfillRectorRule (PHPStan) requires every polyfill-related rule to be registered in the polyfill set

The rule itself stays and can be registered explicitly:

$rectorConfig->rule(AddOverrideAttributeToOverriddenMethodsRector::class);

TomasVotruba and others added 2 commits August 8, 2026 07:06
…olyfill sets

The rule adds #[Override] to every overridden method, which spams the
codebase with attributes without bringing real value. It stays available
for explicit opt-in registration.

Also drops RelatedPolyfillInterface, as it is no longer part of the
php-polyfills set.
@TomasVotruba
TomasVotruba merged commit 7ba3da3 into main Aug 8, 2026
64 checks passed
@TomasVotruba
TomasVotruba deleted the remove-override-attribute-from-set branch August 8, 2026 05:19
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.

2 participants