diff --git a/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php b/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php index 250028a13..ee5309c5f 100644 --- a/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php @@ -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; diff --git a/tests/MagicMethodAnnotationTest.php b/tests/MagicMethodAnnotationTest.php index eb2e81687..ed61867c8 100644 --- a/tests/MagicMethodAnnotationTest.php +++ b/tests/MagicMethodAnnotationTest.php @@ -598,6 +598,23 @@ class MagicMethodAnnotationTest extends TestCase /** @psalm-suppress UndefinedMagicMethod */ $child->foo();' ], + 'allowFinalOverrider' => [ + '