1
0
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:
Brown 2020-02-06 16:32:26 -05:00
parent 9af12932b5
commit 54efbbe831
2 changed files with 9 additions and 9 deletions

View File

@ -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']

View File

@ -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' => [