Skip to content

Commit

Permalink
fix: array_filter messing with keys
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinludwig committed Jan 21, 2025
1 parent 9e82366 commit 9e443ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Checkers/SourceCodeChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ private function getConstantNames(ReflectionClass $reflection): array
{
return array_map(
fn (ReflectionClassConstant $constant): string => $constant->name,
array_filter(
array_values(array_filter(
$reflection->getReflectionConstants(),
function (ReflectionClassConstant $constant) use ($reflection): bool {
if ($constant->class !== $reflection->name) {
return false;
}

foreach ($reflection->getTraits() as $trait) {
if ($trait->hasConstant($constant->getName())) {
return false;
Expand All @@ -205,7 +206,7 @@ function (ReflectionClassConstant $constant) use ($reflection): bool {

return true;
}
)
))
);
}

Expand Down

0 comments on commit 9e443ba

Please sign in to comment.