Skip to content
Snippets Groups Projects
Commit 9de18e66 authored by Jan Kuchař's avatar Jan Kuchař
Browse files

allowed to call self::VALUE2() on child classes

parent 16fc102f
No related branches found
No related tags found
1 merge request!3docs: add order state example
Pipeline #14409 passed
......@@ -64,7 +64,7 @@ abstract class Enum
{
\assert(\count($arguments) === 0);
$value = self::getMeta()->getValueForConstantName($constantName);
$value = self::getMeta(FALSE)->getValueForConstantName($constantName);
if($value === NULL) {
throw new \Error('Call to undefined method ' . static::class . '::' . $constantName . '(). Please check that you have provided constant, annotation and value.');
}
......
......@@ -61,12 +61,16 @@ $expectNonRootAccess(function () {
$expectNonRootAccess(function () {
Value1::fromScalar('1');
});
$expectNonRootAccess(function () {
Value1::VALUE1();
});
$expectNonRootAccess(function () {
Value1::VALUE2();
});
//$expectNonRootAccess(function () {
// Value1::VALUE1();
//});
//$expectNonRootAccess(function () {
// Value1::VALUE2();
//});
Assert::type(Value1::class, Value1::VALUE1());
Assert::type(Value1::class, Value2::VALUE1());
Assert::type(Value2::class, Value1::VALUE2());
Assert::type(Value2::class, Value2::VALUE2());
// valid edge case: this is valid and accesses registers the same way as calls above
Assert::same(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment