From ecbff6eb3875da8720d380db8526d64e3cda0db7 Mon Sep 17 00:00:00 2001 From: Ian Foulds Date: Tue, 3 Oct 2023 16:35:12 +0100 Subject: [PATCH] Fix phpcs and psalm issues. Signed-off-by: Ian Foulds --- src/ReflectionHydrator.php | 5 +++-- test/ReflectionHydratorTest.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ReflectionHydrator.php b/src/ReflectionHydrator.php index e64e96e..088ad91 100644 --- a/src/ReflectionHydrator.php +++ b/src/ReflectionHydrator.php @@ -62,17 +62,18 @@ public function hydrate(array $data, object $object, bool $includeParentProperti */ protected static function getReflProperties(object $input, bool $includeParentProperties): array { - $class = get_class($input); + $reflClass = new ReflectionClass($input); + $class = $reflClass->getName(); if (isset(static::$reflProperties[$class])) { return static::$reflProperties[$class]; } static::$reflProperties[$class] = []; - $reflClass = new ReflectionClass($class); do { foreach ($reflClass->getProperties() as $property) { + /** @psalm-suppress UnusedMethodCall - Bizarre, this is a void return!!! */ $property->setAccessible(true); static::$reflProperties[$class][$property->getName()] = $property; } diff --git a/test/ReflectionHydratorTest.php b/test/ReflectionHydratorTest.php index 83f0f59..03805c0 100644 --- a/test/ReflectionHydratorTest.php +++ b/test/ReflectionHydratorTest.php @@ -12,6 +12,8 @@ use stdClass; use TypeError; +use function get_parent_class; + #[CoversClass(ReflectionHydrator::class)] class ReflectionHydratorTest extends TestCase {