Skip to content

[CodeQuality] Skip is_a() with allow_string on a possible class-string in AssertTrueFalseToSpecificMethodRector - #850

Merged
TomasVotruba merged 1 commit into
mainfrom
is-a-allow-string-skip
Dec 2, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
is-a-allow-string-skip

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

With $allow_string set, is_a() also accepts a class-string, while assertInstanceOf() / assertNotInstanceOf() require an object. For $anything = Foo::class the original fails and the new assert passes:

-$this->assertFalse(is_a($anything, Foo::class, true));
+$this->assertNotInstanceOf(Foo::class, $anything);

is_a() with a 3rd arg that is not false is now only changed when the first arg is known to be an object.

@TomasVotruba
TomasVotruba force-pushed the is-a-allow-string-skip branch from 618248a to ba590b7 Compare December 2, 2026 11:02
@TomasVotruba
TomasVotruba force-pushed the is-a-allow-string-skip branch from ba590b7 to de22bd8 Compare December 2, 2026 11:05
@TomasVotruba
TomasVotruba enabled auto-merge (squash) December 2, 2026 11:05
@TomasVotruba
TomasVotruba merged commit 169a805 into main Dec 2, 2026
15 checks passed
@TomasVotruba
TomasVotruba deleted the is-a-allow-string-skip branch December 2, 2026 11:06
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