Skip to content

[Privatization] Skip Symfony Command protected static property in PrivatizeFinalClassPropertyRector#8201

Merged
TomasVotruba merged 2 commits into
mainfrom
privatize-skip-symfony-command-static
Jul 22, 2026
Merged

[Privatization] Skip Symfony Command protected static property in PrivatizeFinalClassPropertyRector#8201
TomasVotruba merged 2 commits into
mainfrom
privatize-skip-symfony-command-static

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

PrivatizeFinalClassPropertyRector must keep a protected static property that is declared on a parent class. Symfony console commands are the common real-world case:

use Symfony\Component\Console\Command\Command;

final class SendWinnerEmailCommand extends Command
{
    protected static $defaultDescription = 'Send winner email variant to remaining contacts';
}

Command declares protected static $defaultDescription, so privatizing the child override would break the parent contract. The property must stay protected (unchanged).

The ParentPropertyLookupGuard already guards this via hasStaticProperty(); this PR adds a fixture locking the behavior against a real Symfony\Component\Console\Command\Command parent.

…atic property in PrivatizeFinalClassPropertyRector
…erties even when parent no longer declares them
@TomasVotruba
TomasVotruba enabled auto-merge (squash) July 22, 2026 10:15
@TomasVotruba
TomasVotruba merged commit 286fdb5 into main Jul 22, 2026
65 of 66 checks passed
@TomasVotruba
TomasVotruba deleted the privatize-skip-symfony-command-static branch July 22, 2026 10:16
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