Skip to content

Commit

Permalink
Merge pull request #16 from veewee/duplicate-indexing
Browse files Browse the repository at this point in the history
Remove duplicate properties indexing
  • Loading branch information
veewee authored Jun 18, 2024
2 parents 8b0b2f6 + 50c08e7 commit 3be0aaa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Reflect/properties_get.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use VeeWee\Reflecta\Reflect\Exception\UnreflectableException;
use VeeWee\Reflecta\Reflect\Type\ReflectedClass;
use VeeWee\Reflecta\Reflect\Type\ReflectedProperty;
use function Psl\Dict\pull;
use function Psl\Dict\map;

/**
* @param null|Closure(ReflectedProperty): bool $predicate
Expand All @@ -16,9 +16,8 @@
*/
function properties_get(object $object, Closure|null $predicate = null): array
{
return pull(
return map(
ReflectedClass::fromObject($object)->properties($predicate),
static fn (ReflectedProperty $property): mixed => property_get($object, $property->name()),
static fn (ReflectedProperty $property): string => $property->name()
);
}

0 comments on commit 3be0aaa

Please sign in to comment.