Skip to content

Commit ad29500

Browse files
kalessilfabpot
authored andcommitted
[2.3] Static Code Analysis for Components
1 parent 931d3db commit ad29500

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Extension/Core/DataTransformer/BaseDateTimeTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
4040
*/
4141
public function __construct($inputTimezone = null, $outputTimezone = null)
4242
{
43-
if (!is_string($inputTimezone) && null !== $inputTimezone) {
43+
if (null !== $inputTimezone && !is_string($inputTimezone)) {
4444
throw new UnexpectedTypeException($inputTimezone, 'string');
4545
}
4646

47-
if (!is_string($outputTimezone) && null !== $outputTimezone) {
47+
if (null !== $outputTimezone && !is_string($outputTimezone)) {
4848
throw new UnexpectedTypeException($outputTimezone, 'string');
4949
}
5050

Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public function transform($dateTime)
9999
// remove leading zeros
100100
$entry = (string) (int) $entry;
101101
}
102+
// unset reference to keep scope clear
103+
unset($entry);
102104
}
103105

104106
return $result;

Extension/Core/EventListener/MergeCollectionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function onSubmit(FormEvent $event)
7474
}
7575

7676
// If we are not allowed to change anything, return immediately
77-
if ((!$this->allowAdd && !$this->allowDelete) || $data === $dataToMergeInto) {
77+
if ($data === $dataToMergeInto || (!$this->allowAdd && !$this->allowDelete)) {
7878
$event->setData($dataToMergeInto);
7979

8080
return;

0 commit comments

Comments
 (0)