Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2024-10-14 14:48:35 +02:00
commit d57e1c55af
No known key found for this signature in database
GPG key ID: 8571BFA20420D512

View file

@ -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'];