1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix issue with undefined class constant keys

This commit is contained in:
Matt Brown 2018-05-10 13:01:55 -04:00
parent afe3b936d4
commit 444dd33118
2 changed files with 14 additions and 1 deletions

View File

@ -779,7 +779,7 @@ class StatementsChecker extends SourceChecker implements StatementsSource
return Type::getClassString();
}
return null;
return Type::getMixed();
}
if ($stmt instanceof PhpParser\Node\Scalar\String_) {

View File

@ -108,6 +108,19 @@ class ConstantTest extends TestCase
'assertions' => [],
'error_levels' => ['MixedAssignment'],
],
'hardToDefineClassConstant' => [
'<?php
class A {
const C = [
self::B => 4,
"name" => 3
];
const B = 4;
}
echo A::C[4];',
],
];
}