Skip to content

[TypeDeclaration] Deprecate BinaryOpNullableToInstanceofRector, fold into ExplicitNullableObjectInstanceRector - #8817

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-binaryop-nullable-to-instanceof
Oct 25, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-binaryop-nullable-to-instanceof

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Folds BinaryOpNullableToInstanceofRector into ExplicitNullableObjectInstanceRector, continuing the campaign that already merged FlipTypeControlToUseExclusiveTypeRector, ObjectExplicitBoolCompareRector, EmptyOnNullableObjectToInstanceOfRector and WhileNullableToInstanceofRector into one rule.

ExplicitNullableObjectInstanceRector now also subscribes to BooleanAnd/BooleanOr and turns nullable-object truthiness operands into explicit instanceof checks (including the !$a || !$b negation shape). The old rule is deprecated (throws via DeprecatedInterface) and removed from TypeDeclarationLevel.

Its fixtures and source classes moved under the ExplicitNullableObjectInstanceRector test with a binaryop_ prefix; all 28 tests pass.

@TomasVotruba
TomasVotruba merged commit b311756 into main Oct 25, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-deprecate-binaryop-nullable-to-instanceof branch October 25, 2026 11:05
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