[2.0.x] Fix readonly false positive in DependencySerializationTraitPropertyRule - #1017
Merged
Conversation
…le (#1010) * Fix readonly false positive in DependencySerializationTraitPropertyRule The rule flagged every readonly property on classes using DependencySerializationTrait. The trait's __sleep() never mutates properties, and __wakeup() initializes an excluded readonly property from the trait's composing class scope, which PHP allows. The check now only reports readonly properties that can hold an object when the trait comes from a parent class on PHP < 8.4, where the parent-scope initialization in __wakeup() throws. Fixes #1009 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Run test suite on PHP 8.4 The DependencySerializationTraitPropertyRule readonly check now branches on PHP < 8.4 vs 8.4+, so the test matrix should exercise both runtimes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Cherry-pick of #1010 (28f3f46) to 2.0.x. Fixes #1009 / #889 for the 2.0.x line.
One deviation from the original commit: the
.github/workflows/php.ymlhunk (adding a PHP 8.4 matrix leg) was dropped. The 2.0.x matrix still includes~11.2.0, which is no longer installable due to unfixed core security advisories (see #1011), so new 8.4 legs would fail for unrelated reasons. The rule tests constructPhpVersionwith 8.3 and 8.4 directly, so both analyzed-version code paths are covered on every runtime without the extra CI leg.Rule + full suite and phpstan pass on 2.0.x.
Note for release notes: the error message/tip text changed, so
ignoreErrorsentries matching on message text will become unmatched (identifier is unchanged).🤖 Generated with Claude Code