Skip to content

[TypeDeclaration] Migrate EmptyOnNullableObjectToInstanceOfRector to NullableObjectToInstanceofFactory - #8635

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-empty-nullable-instanceof-factory
Oct 11, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-empty-nullable-instanceof-factory

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #8633. That PR extracted NullableObjectToInstanceofFactory and migrated four rules, leaving EmptyOnNullableObjectToInstanceOfRector out because it built the instanceof target through StaticTypeMapper::mapPHPStanTypeToPhpParserNode() -> Name rather than FullyQualified(getClassName()).

For a plain nullable ObjectType (what this rule has after TypeCombinator::removeNull()), both paths resolve to the same fully qualified name, so the rule now uses the shared factory. This drops the StaticTypeMapper dependency and the instanceof Name guard.

Added aliased_import.php.inc to lock the one path where the two approaches could in theory diverge - an aliased import (use X as Y) - confirming the factory still emits the real FQCN, not the alias.

No behavior change; existing fixtures pass unchanged.

@TomasVotruba
TomasVotruba merged commit be3da68 into main Oct 11, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-empty-nullable-instanceof-factory branch October 11, 2026 19:43
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