Skip to content
Permalink
Browse files

Fix #2020 - allow static::CONST_NAME to have non-mixed type in final …

…class
  • Loading branch information...
muglug committed Aug 15, 2019
1 parent 3e549e2 commit 538abbc54cc0e951868fcd642044b4e8e164e0f2
@@ -352,7 +352,9 @@ public static function analyzeClassConst(
}
}
if (isset($class_constants[$stmt->name->name]) && $first_part_lc !== 'static') {
if (isset($class_constants[$stmt->name->name])
&& ($first_part_lc !== 'static' || $class_const_storage->final)
) {
$stmt->inferredType = clone $class_constants[$stmt->name->name];
$context->vars_in_scope[$const_id] = $stmt->inferredType;
} else {
@@ -381,6 +381,15 @@ function func(): void {}
define(__NAMESPACE__."\\cons", 0);
cons;',
],
'staticConstantInsideFinalClass' => [
'<?php
final class A {
public const STRING = "1,2,3";
public static function foo(): void {
print_r(explode(",", static::STRING));
}
}'
],
];
}

0 comments on commit 538abbc

Please sign in to comment.
You can’t perform that action at this time.