From 7c136f382579ac7be846d391604d06dd709c0c8b Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 21 Jul 2026 11:55:29 +0530 Subject: [PATCH] Fix Rector refactor:check: avoid false-positive assertTrue(is_a()) -> assertInstanceOf() rewrite Rector's AssertTrueFalseToSpecificMethodRector rewrites assertTrue(is_a($x, Y::class, true)) to assertInstanceOf(Y::class, $x), but $entry['oauth2'] is a class-string, not an object -- assertInstanceOf requires an actual instance. Rewritten to assertContains() over class_implements(), which is both correct and doesn't match the rule's pattern. --- tests/unit/Vcs/FactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Vcs/FactoryTest.php b/tests/unit/Vcs/FactoryTest.php index 578cd9d95c..f66bb26aef 100644 --- a/tests/unit/Vcs/FactoryTest.php +++ b/tests/unit/Vcs/FactoryTest.php @@ -33,7 +33,7 @@ final class FactoryTest extends TestCase foreach ($registry as $key => $entry) { $this->assertTrue(\is_subclass_of($entry['adapter'], Git::class), "Adapter for '{$key}' must extend Git"); - $this->assertTrue(\is_a($entry['oauth2'], EnvOAuth2::class, true), "OAuth2 client for '{$key}' must implement EnvOAuth2"); + $this->assertContains(EnvOAuth2::class, \class_implements($entry['oauth2']) ?: [], "OAuth2 client for '{$key}' must implement EnvOAuth2"); $this->assertNotEmpty($entry['variables'], "Variables missing for '{$key}'"); foreach ($entry['variables'] as $name => $variable) { $this->assertStringStartsWith('_APP_VCS_', $variable['envVariable'] ?? '', "Env variable for '{$name}' missing or invalid for '{$key}'");