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:
parent
afe3b936d4
commit
444dd33118
@ -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_) {
|
||||
|
@ -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];',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user