mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 06:44:04 +00:00
Merge meta properties in one go instead of in a loop
This commit is contained in:
parent
ca36e6dbe4
commit
5db9997149
1 changed files with 5 additions and 4 deletions
|
|
@ -25,11 +25,12 @@ class Reflection
|
|||
// Traits except the `Metadata` trait
|
||||
$traits = array_values(array_filter($reflection->getTraits(), fn (ReflectionClass $class) => $class->getName() !== 'ArchTech\Enums\Metadata'));
|
||||
|
||||
foreach ($traits as $trait) {
|
||||
$metaProperties = array_merge($metaProperties, static::parseMetaProperties($trait));
|
||||
}
|
||||
$traitsMeta = array_map(
|
||||
fn (ReflectionClass $trait) => static::parseMetaProperties($trait),
|
||||
$traits
|
||||
);
|
||||
|
||||
return $metaProperties;
|
||||
return array_merge($metaProperties, ...$traitsMeta);
|
||||
}
|
||||
|
||||
/** @param ReflectionClass<object> $reflection */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue