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

Test for dynamic enum fetch

This commit is contained in:
Evan Shaw 2024-02-05 21:51:34 +13:00
parent a827806709
commit 4cec31eba9
2 changed files with 20 additions and 1 deletions

View File

@ -2485,7 +2485,7 @@ class ConstantTest extends TestCase
$a = C::{"A"};
',
'error_message' => 'ParseError',
'errors_levels' => [],
'error_levels' => [],
'php_version' => '8.2',
],
];

View File

@ -1029,6 +1029,25 @@ class UnusedVariableTest extends TestCase
'ignored_issues' => [],
'php_version' => '8.3',
],
'usedAsEnumFetch' => [
'code' => '<?php
enum E {
case C;
}
class A {
public function foo() : void {
$var = "C";
if (rand(0, 1)) {
E::{$var};
}
}
}',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.3',
],
'usedAsStaticPropertyAssign' => [
'code' => '<?php
class A {