1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #3320 - add final flag to pseudo methods where appropriate

This commit is contained in:
Brown 2020-05-08 07:28:12 -04:00
parent 4295f9525f
commit 65b4263315
2 changed files with 18 additions and 0 deletions

View File

@ -1592,6 +1592,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
$storage->defining_fqcln = '';
$storage->is_static = $stmt->isStatic();
$class_storage = $this->classlike_storages[count($this->classlike_storages) - 1];
$storage->final = $class_storage->final;
} elseif ($stmt instanceof PhpParser\Node\Stmt\Function_) {
$cased_function_id =
($this->aliases->namespace ? $this->aliases->namespace . '\\' : '') . $stmt->name->name;

View File

@ -598,6 +598,23 @@ class MagicMethodAnnotationTest extends TestCase
/** @psalm-suppress UndefinedMagicMethod */
$child->foo();'
],
'allowFinalOverrider' => [
'<?php
class A {
/**
* @return static
*/
public static function foo()
{
return new static();
}
}
/**
* @method static B foo()
*/
final class B extends A {}'
],
];
}