Skip to content

Commit 5d3cf78

Browse files
authored
Updated checkstyle library and embrace PER 2.0 (#159)
1 parent 9b517b3 commit 5d3cf78

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/SkipInvalidItemProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public function __construct(
2121
/**
2222
* @var Constraint[]|null
2323
*/
24-
private ?array $contraints = null,
24+
private null|array $contraints = null,
2525
/**
2626
* @var string[]|null
2727
*/
28-
private ?array $groups = null,
28+
private null|array $groups = null,
2929
) {
3030
}
3131

@@ -47,7 +47,7 @@ public function process(mixed $item): mixed
4747
*
4848
* @return Iterator<string>
4949
*/
50-
private function normalizeConstraints(?array $constraints): Iterator
50+
private function normalizeConstraints(null|array $constraints): Iterator
5151
{
5252
foreach ($constraints ?? [] as $constraint) {
5353
yield $constraint::class;

src/SkipItemOnViolations.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(
2020
/**
2121
* @var ConstraintViolationListInterface<ConstraintViolationInterface>
2222
*/
23-
private ConstraintViolationListInterface $violations
23+
private ConstraintViolationListInterface $violations,
2424
) {
2525
}
2626

@@ -34,16 +34,16 @@ public function report(JobExecution $execution, int|string $index, mixed $item):
3434
'%s: %s (invalid value: %s)',
3535
$violation->getPropertyPath(),
3636
$violation->getMessage(),
37-
$this->normalizeInvalidValue($violation->getInvalidValue())
37+
$this->normalizeInvalidValue($violation->getInvalidValue()),
3838
);
3939
}
4040

4141
$execution->addWarning(
4242
new Warning(
4343
'Violations were detected by validator.',
4444
[],
45-
['itemIndex' => $index, 'item' => $item, 'violations' => $violations]
46-
)
45+
['itemIndex' => $index, 'item' => $item, 'violations' => $violations],
46+
),
4747
);
4848
}
4949

tests/SkipInvalidItemProcessorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SkipInvalidItemProcessorTest extends TestCase
1919
/**
2020
* @dataProvider groups
2121
*/
22-
public function testProcessValid(?array $groups): void
22+
public function testProcessValid(null|array $groups): void
2323
{
2424
$validator = Validation::createValidator();
2525
$processor = new SkipInvalidItemProcessor($validator, [new NotBlank(['groups' => $groups])], $groups);
@@ -29,12 +29,13 @@ public function testProcessValid(?array $groups): void
2929
/**
3030
* @dataProvider groups
3131
*/
32-
public function testProcessInvalid(?array $groups): void
32+
public function testProcessInvalid(null|array $groups): void
3333
{
3434
$validator = Validation::createValidator();
3535
$processor = new SkipInvalidItemProcessor($validator, [new Blank(['groups' => ['Default', 'Full']])], $groups);
3636

3737
$exception = null;
38+
3839
try {
3940
$processor->process('invalid item not blank');
4041
} catch (SkipItemException $exception) {

tests/SkipItemOnViolationsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function test(array $violations, array $expectedViolations): void
3030
self::assertSame([], $execution->getWarnings()[0]->getParameters());
3131
self::assertSame(
3232
['itemIndex' => 'itemIndex', 'item' => 'item', 'violations' => $expectedViolations],
33-
$execution->getWarnings()[0]->getContext()
33+
$execution->getWarnings()[0]->getContext(),
3434
);
3535
}
3636

0 commit comments

Comments
 (0)