1
0
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:
Matthew Brown 2019-06-15 12:19:26 -04:00
parent afc2f18d18
commit 06e913e37b
2 changed files with 12 additions and 1 deletions

View File

@ -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) {

View File

@ -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',
],
];
}
}