Merge branch 'develop' into trunk
This commit is contained in:
commit
d57e1c55af
1 changed files with 6 additions and 5 deletions
|
|
@ -250,19 +250,20 @@ trait BaseEnum
|
|||
$names = array_merge($names, [$enum->name => $enum]);
|
||||
}, self::cases());
|
||||
|
||||
$GLOBALS[self::class]['customProps'] = \array_map(
|
||||
function (mixed $enum) use ($names) {
|
||||
if (!\is_array($enum)) {
|
||||
$GLOBALS[self::class]['customProps'] = \array_filter(
|
||||
(new \ReflectionClass(self::class))->getConstants(),
|
||||
function (mixed $constant, string $key) use ($names) {
|
||||
if ($key === 'LABELS' or !\is_array($constant)) {
|
||||
return false;
|
||||
}
|
||||
return count(\array_filter(
|
||||
$enum,
|
||||
array_flip($constant),
|
||||
function (string $name) use ($names) {
|
||||
return array_key_exists($name, $names);
|
||||
}
|
||||
));
|
||||
},
|
||||
array_flip((new \ReflectionClass(self::class))->getConstants()),
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
} //end if
|
||||
return $GLOBALS[self::class]['customProps'];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue