1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
This commit is contained in:
Daniil Gentili 2022-11-05 19:15:46 +01:00
parent d0be59e16e
commit da21229cab
2 changed files with 39 additions and 1 deletions

View File

@ -780,7 +780,7 @@ class ClassConstAnalyzer
}
// Check overridden final
if ($parent_const_storage->final) {
if ($parent_const_storage->final && $parent_const_storage !== $const_storage) {
IssueBuffer::maybeAdd(
new OverriddenFinalConstant(
"{$const_name} cannot be overridden because it is marked as final in "

View File

@ -1482,6 +1482,44 @@ class ConstantTest extends TestCase
}
',
],
'finalConst' => [
'code' => '<?php
class Foo
{
final public const BAR="baz";
}
class Baz extends Foo
{
}
$a = Baz::BAR;
',
'assertions' => [
'$a===' => "'baz'"
],
'ignored_issues' => [],
'php_version' => '8.1'
],
'finalConstInterface' => [
'code' => '<?php
interface Foo
{
final public const BAR="baz";
}
class Baz implements Foo
{
}
$a = Baz::BAR;
',
'assertions' => [
'$a===' => "'baz'"
],
'ignored_issues' => [],
'php_version' => '8.1'
],
];
}