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.
This commit is contained in:
harsh mahajan committed 2026-07-21 11:55:29 +05:30
1 parent 333ca393ee
commit 7c136f3825
1 file changed
+1 -1
+1 -1
View File
@@ -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}'");