mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #3320 - add final flag to pseudo methods where appropriate
This commit is contained in:
parent
4295f9525f
commit
65b4263315
@ -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;
|
||||
|
@ -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 {}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user