Skip to content

[CodeQuality] Keep original class name in InlineIsAInstanceOfRector - #9032

Merged
TomasVotruba merged 1 commit into
mainfrom
inline-is-a-reuse-class-name
Nov 23, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
inline-is-a-reuse-class-name

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The rule built a new fully qualified name from the resolved class, so an imported short name came out fully qualified:

 use Some\Namespace\SomeType;

-return is_a($object, SomeType::class);
+return $object instanceof \Some\Namespace\SomeType;

Now the original name node from SomeType::class is reused, so the code keeps its spelling:

-return is_a($object, SomeType::class);
+return $object instanceof SomeType;

The fully qualified fallback stays for anything else.

@TomasVotruba
TomasVotruba merged commit 92da7e0 into main Nov 23, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the inline-is-a-reuse-class-name branch November 23, 2026 22: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