Skip to content

Commit

Permalink
Merge pull request #721 from LauJosefsen/speedup-cast-properties-data…
Browse files Browse the repository at this point in the history
…-pipe

Improve performance of CastPropertiesDataPipe by using hash lookups instead of ->first
  • Loading branch information
rubenvanassche authored Apr 4, 2024
2 parents b3a6840 + 7eda411 commit daa17e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DataPipes/CastPropertiesDataPipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function handle(
CreationContext $creationContext
): array {
foreach ($properties as $name => $value) {
$dataProperty = $class->properties->first(fn (DataProperty $dataProperty) => $dataProperty->name === $name);
$dataProperty = $class->properties[$name] ?? null;

if ($dataProperty === null) {
continue;
Expand Down

0 comments on commit daa17e5

Please sign in to comment.