mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
f40e23faef
commit
b822c3339d
@ -191,7 +191,7 @@ final class ArgumentsAnalyzer
|
||||
|
||||
$toggled_class_exists = false;
|
||||
|
||||
if ($method_id === 'class_exists'
|
||||
if (in_array($method_id, ['class_exists', 'interface_exists', 'enum_exists', 'trait_exists'], true)
|
||||
&& $argument_offset === 0
|
||||
&& !$context->inside_class_exists
|
||||
) {
|
||||
|
@ -777,8 +777,31 @@ class FunctionCallTest extends TestCase
|
||||
}',
|
||||
],
|
||||
'allowPossiblyUndefinedClassInClassExists' => [
|
||||
'code' => '<?php
|
||||
if (class_exists(Foo::class)) {}',
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
if (class_exists(Foo::class)) {}
|
||||
PHP,
|
||||
],
|
||||
'allowPossiblyUndefinedClassInInterfaceExists' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
if (interface_exists(Foo::class)) {}
|
||||
PHP,
|
||||
],
|
||||
'allowPossiblyUndefinedClassInTraitExists' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
if (trait_exists(Foo::class)) {}
|
||||
PHP,
|
||||
],
|
||||
'allowPossiblyUndefinedClassInEnumExists' => [
|
||||
'code' => <<<'PHP'
|
||||
<?php
|
||||
if (enum_exists(Foo::class)) {}
|
||||
PHP,
|
||||
'assertions' => [],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
'allowConstructorAfterClassExists' => [
|
||||
'code' => '<?php
|
||||
|
Loading…
Reference in New Issue
Block a user