mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #1791 - complain about missing class constants
This commit is contained in:
parent
afc2f18d18
commit
06e913e37b
@ -216,7 +216,7 @@ class ConstFetchAnalyzer
|
||||
$class_visibility
|
||||
);
|
||||
|
||||
if (!isset($class_constants[$stmt->name->name]) && $first_part_lc !== 'static') {
|
||||
if (!isset($class_constants[$stmt->name->name])) {
|
||||
$all_class_constants = [];
|
||||
|
||||
if ($fq_class_name !== $context->self) {
|
||||
|
@ -487,6 +487,17 @@ class ConstantTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'UndefinedConstant',
|
||||
],
|
||||
'preventStaticClassConstWithoutRef' => [
|
||||
'<?php
|
||||
class Foo {
|
||||
public const CONST = 1;
|
||||
|
||||
public function x() : void {
|
||||
echo static::CON;
|
||||
}
|
||||
}',
|
||||
'error_message' => 'UndefinedConstant',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user