Skip to content

Commit

Permalink
Fixed wrong typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
zmitic committed Aug 5, 2022
1 parent d1265fa commit ac8650c
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/Accessor/CollectionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ public function update(array $options, &$data, FormInterface $form): void
}

$removeEntry = $options['entry_options']['remove_entry'] ?? null;
$removalCallback = $this->extractRemoveEntryFromCollection($form);
foreach ($toRemove as $item) {
if ($removeEntry) {
$removeEntry($item);
}
if ($removalCallback) {
$removalCallback($item);
}
$this->submit($data, $item, $removerReflection);
}
}
Expand Down Expand Up @@ -113,7 +109,7 @@ private function getExtraValues(callable $compare, array $originalValues, array
return $extraValues;
}

private function search(callable $compare, int|string $key, object|array $value, object|array $originalValues): false|int|string
private function search(callable $compare, int|string $key, mixed $value, object|array $originalValues): false|int|string
{
foreach ($originalValues as $originalKey => $originalValue) {
if ($value && $originalValue && $compare($value, $originalValue, $key, $originalKey) === true) {
Expand All @@ -123,15 +119,4 @@ private function search(callable $compare, int|string $key, object|array $value,

return false;
}

private function extractRemoveEntryFromCollection(FormInterface $form): ?Closure
{
foreach ($form as $child) {
$options = $child->getConfig()->getOptions();

return $options['remove_entry'] ?? null;
}

return null;
}
}

0 comments on commit ac8650c

Please sign in to comment.