mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #8664
This commit is contained in:
parent
d0be59e16e
commit
da21229cab
@ -780,7 +780,7 @@ class ClassConstAnalyzer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check overridden final
|
// Check overridden final
|
||||||
if ($parent_const_storage->final) {
|
if ($parent_const_storage->final && $parent_const_storage !== $const_storage) {
|
||||||
IssueBuffer::maybeAdd(
|
IssueBuffer::maybeAdd(
|
||||||
new OverriddenFinalConstant(
|
new OverriddenFinalConstant(
|
||||||
"{$const_name} cannot be overridden because it is marked as final in "
|
"{$const_name} cannot be overridden because it is marked as final in "
|
||||||
|
@ -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'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user