Add AddOverrideAttributeToOverriddenPropertiesRector for PHP 8.5#7880
Open
carlos-granados wants to merge 1 commit intorectorphp:mainfrom
Open
Add AddOverrideAttributeToOverriddenPropertiesRector for PHP 8.5#7880carlos-granados wants to merge 1 commit intorectorphp:mainfrom
carlos-granados wants to merge 1 commit intorectorphp:mainfrom
Conversation
samsonasik
reviewed
Feb 4, 2026
rules/Php85/Rector/Property/AddOverrideAttributeToOverriddenPropertiesRector.php
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Feb 4, 2026
...p85/Rector/Property/AddOverrideAttributeToOverriddenPropertiesRector/Fixture/fixture.php.inc
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Feb 4, 2026
.../AddOverrideAttributeToOverriddenPropertiesRector/Fixture/skip_already_has_attribute.php.inc
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Feb 4, 2026
...ddOverrideAttributeToOverriddenPropertiesRector/Fixture/skip_parent_private_property.php.inc
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Feb 4, 2026
...perty/AddOverrideAttributeToOverriddenPropertiesRector/Fixture/skip_private_property.php.inc
Outdated
Show resolved
Hide resolved
f0fd451 to
b971816
Compare
This rule adds the #[\Override] attribute to properties that override parent class properties. PHP 8.5 extends the Override attribute to support properties in addition to methods. The rule: - Adds #[\Override] to public/protected properties that override parent properties - Skips private properties (cannot truly override) - Skips properties where parent is private (not visible to child) - Skips properties that already have the attribute
b971816 to
f4d45e2
Compare
Contributor
Author
|
@samsonasik thanks for your review, all updated with your suggestions |
samsonasik
approved these changes
Feb 5, 2026
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.
This rule adds the #[\Override] attribute to properties that override parent class properties. PHP 8.5 extends the Override attribute to support properties in addition to methods.
The rule:
Fixes rectorphp/rector#9579