mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix bad assertion
This commit is contained in:
parent
9af12932b5
commit
54efbbe831
@ -699,9 +699,9 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
|
||||
$var = $stmt->args[0]->value;
|
||||
|
||||
if ($var instanceof PhpParser\Node\Expr\Variable
|
||||
&& $var->name instanceof PhpParser\Node\Identifier
|
||||
&& is_string($var->name)
|
||||
) {
|
||||
$var_id = '$' . $var->name->name;
|
||||
$var_id = '$' . $var->name;
|
||||
|
||||
if (isset($context->vars_in_scope[$var_id])) {
|
||||
$atomic_type = $stmt->name->parts === ['get_class']
|
||||
|
@ -67,16 +67,16 @@ class SwitchTypeTest extends TestCase
|
||||
'<?php
|
||||
class A {}
|
||||
class B extends A {
|
||||
public function foo(): void {}
|
||||
public function foo(): void {}
|
||||
}
|
||||
|
||||
function takesA(A $a): void {
|
||||
$class = get_class($a);
|
||||
switch ($class) {
|
||||
case B::class:
|
||||
$a->foo();
|
||||
break;
|
||||
}
|
||||
$class = get_class($a);
|
||||
switch ($class) {
|
||||
case B::class:
|
||||
$a->foo();
|
||||
break;
|
||||
}
|
||||
}',
|
||||
],
|
||||
'getTypeArg' => [
|
||||
|
Loading…
Reference in New Issue
Block a user