Skip to content

Commit

Permalink
Fix phpcs and psalm issues.
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Foulds <[email protected]>
  • Loading branch information
ianef committed Oct 3, 2023
1 parent 2cf8252 commit 4ec1371
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ReflectionHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions test/ReflectionHydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use stdClass;
use TypeError;

use function get_parent_class;

#[CoversClass(ReflectionHydrator::class)]
class ReflectionHydratorTest extends TestCase
{
Expand Down

0 comments on commit 4ec1371

Please sign in to comment.