Skip to content

Commit 4abcb35

Browse files
committed
use the empty string instead of null as an array offset
1 parent ce4d50b commit 4abcb35

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Tests/Fixtures/FixedDataTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct(array $mapping)
2525

2626
public function transform($value): mixed
2727
{
28+
$value ??= '';
2829
if (!\array_key_exists($value, $this->mapping)) {
2930
throw new TransformationFailedException(sprintf('No mapping for value "%s"', $value));
3031
}

Tests/Fixtures/FixedFilterListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public function preSetData(FormEvent $event)
5050
{
5151
$data = $event->getData();
5252

53-
if (isset($this->mapping['preSetData'][$data])) {
54-
$event->setData($this->mapping['preSetData'][$data]);
53+
if (isset($this->mapping['preSetData'][$data ?? ''])) {
54+
$event->setData($this->mapping['preSetData'][$data ?? '']);
5555
}
5656
}
5757

0 commit comments

Comments
 (0)