Skip to content

[CodeQuality] Deprecate CompleteDynamicPropertiesRector - #8753

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-complete-dynamic-properties
Oct 21, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
deprecate-complete-dynamic-properties

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The rule guesses property types from assignments and can emit invalid properties on classes with only partial type information - e.g. when a parent or trait already declares the property under conditions Rector cannot see.

Adding missing properties by hand with correct types is safer, so the rule is deprecated:

  • CompleteDynamicPropertiesRector now implements DeprecatedInterface, body throws
  • removed from CodeQualityLevel
  • removed its tests
  • dropped the now-orphaned helpers it was the sole caller of (LocalPropertyAnalyzer, MissingPropertiesResolver, MissingPropertiesFactory, ClassLikeAnalyzer, ArrayDimFetchTypeResolver, PropertyTypeDecorator, DefinedPropertyWithType), and trimmed the unused hasClassContextProperty() from PropertyPresenceChecker

The rule can create invalid properties on classes with partial type information, better handled by adding typed properties by hand.
@TomasVotruba
TomasVotruba merged commit b57d8b9 into main Oct 21, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-complete-dynamic-properties branch October 21, 2026 20:55
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