Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,28 @@
<InvalidOperand>
<code><![CDATA[$guessers]]></code>
</InvalidOperand>
<MixedReturnStatement>
<code><![CDATA[(new ReflectionClass($class))->newLazyProxy(
function () use ($metadata, $data): object {
return $this->doHydrate($metadata, $data);
},
)]]></code>
</MixedReturnStatement>
<PossiblyInvalidArgument>
<code><![CDATA[[
...$guessers,
$guesser,
]]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Normalizer/ArrayNormalizer.php">
<MixedAssignment>
<code><![CDATA[$item]]></code>
<code><![CDATA[$item]]></code>
<code><![CDATA[$item]]></code>
<code><![CDATA[$item]]></code>
</MixedAssignment>
</file>
<file src="src/Normalizer/ArrayShapeNormalizer.php">
<MixedAssignment>
<code><![CDATA[$result[$field]]]></code>
Expand Down Expand Up @@ -89,23 +104,6 @@
<code><![CDATA[$value]]></code>
</MixedArgumentTypeCoercion>
</file>
<file src="tests/Benchmark/tideways.php">
<ClassMustBeFinal>
<code><![CDATA[CompiledMetadataHydrator]]></code>
</ClassMustBeFinal>
<MixedMethodCall>
<code><![CDATA[normalize]]></code>
<code><![CDATA[normalize]]></code>
</MixedMethodCall>
<MixedReturnTypeCoercion>
<code><![CDATA[array]]></code>
<code><![CDATA[match (true) {
$object instanceof ProfileCreated => $this->extractProfileCreated($object),
$object instanceof Skill => $this->extractSkill($object),
default => throw new InvalidArgumentException('Unknown object type'),
}]]></code>
</MixedReturnTypeCoercion>
</file>
<file src="tests/Unit/Cryptography/Cipher/OpensslCipherTest.php">
<MixedAssignment>
<code><![CDATA[$return]]></code>
Expand Down
13 changes: 10 additions & 3 deletions src/Normalizer/ArrayNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\TypeInfo\Type\CollectionType;
use Symfony\Component\TypeInfo\Type\NullableType;

use function array_map;
use function is_array;

#[Attribute(Attribute::TARGET_PROPERTY)]
Expand All @@ -32,7 +31,11 @@ public function normalize(mixed $value): array|null
throw InvalidArgument::withWrongType('array|null', $value);
}

return array_map(fn (mixed $value): mixed => $this->normalizer->normalize($value), $value);
foreach ($value as &$item) {
$item = $this->normalizer->normalize($item);
}

return $value;
}

/** @return array<array-key, mixed>|null */
Expand All @@ -46,7 +49,11 @@ public function denormalize(mixed $value): array|null
throw InvalidArgument::withWrongType('array|null', $value);
}

return array_map(fn (mixed $value): mixed => $this->normalizer->denormalize($value), $value);
foreach ($value as &$item) {
$item = $this->normalizer->denormalize($item);
}

return $value;
}

public function setHydrator(Hydrator $hydrator): void
Expand Down
Loading