mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
This commit is contained in:
parent
5bc657504d
commit
2f646d29db
@ -641,7 +641,9 @@ class FunctionCallAnalyzer extends CallAnalyzer
|
||||
|
||||
if (strpos($var_type_part->value, '::')) {
|
||||
$parts = explode('::', strtolower($var_type_part->value));
|
||||
$potential_method_id = new \Psalm\Internal\MethodIdentifier($parts[0], $parts[1]);
|
||||
$fq_class_name = $parts[0];
|
||||
$fq_class_name = \preg_replace('/^\\\\/', '', $fq_class_name);
|
||||
$potential_method_id = new \Psalm\Internal\MethodIdentifier($fq_class_name, $parts[1]);
|
||||
} else {
|
||||
$explicit_function_name = new PhpParser\Node\Name\FullyQualified(
|
||||
$var_type_part->value,
|
||||
|
@ -703,6 +703,22 @@ class UnusedCodeTest extends TestCase
|
||||
|
||||
createFoo(Foo::class)->baz();'
|
||||
],
|
||||
'usedMethodReferencedByString' => [
|
||||
'<?php
|
||||
class A {
|
||||
static function b(): void {}
|
||||
}
|
||||
$methodRef = "A::b";
|
||||
$methodRef();',
|
||||
],
|
||||
'usedMethodReferencedByStringWithLeadingBackslash' => [
|
||||
'<?php
|
||||
class A {
|
||||
static function b(): void {}
|
||||
}
|
||||
$methodRef = "\A::b";
|
||||
$methodRef();',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user