Skip to content

Commit 24cf58c

Browse files
committed
enable phpunitCodeQuality prepared set
1 parent 0954ec2 commit 24cf58c

File tree

4 files changed

+313
-337
lines changed

4 files changed

+313
-337
lines changed

rector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
deadCode: true,
1414
naming: true,
1515
privatization: true,
16-
typeDeclarations: true
16+
typeDeclarations: true,
17+
phpunitCodeQuality: true
1718
)
1819
->withComposerBased(phpunit: true)
1920
->withSkip([

tests/AtLeastTest.php

Lines changed: 61 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace ArrayLookup\Tests;
66

77
use ArrayLookup\AtLeast;
8+
use Iterator;
89
use PHPUnit\Framework\Attributes\DataProvider;
910
use PHPUnit\Framework\TestCase;
1011

@@ -19,29 +20,27 @@ public function testOnce(array $data, callable $filter, bool $expected): void
1920
);
2021
}
2122

22-
public static function onceDataProvider(): array
23+
public static function onceDataProvider(): Iterator
2324
{
24-
return [
25-
[
26-
[1, 2, 3],
27-
static fn($datum): bool => $datum === 1,
28-
true,
29-
],
30-
[
31-
[1, 2, 3],
32-
static fn($datum): bool => $datum === 4,
33-
false,
34-
],
35-
[
36-
['abc', 'def', 'some test'],
37-
static fn(string $datum, int $key): bool => $datum === 'def' && $key === 1,
38-
true,
39-
],
40-
[
41-
['abc', 'def', 'some test'],
42-
static fn(string $datum, int $key): bool => $datum === 'def' && $key === 2,
43-
false,
44-
],
25+
yield [
26+
[1, 2, 3],
27+
static fn($datum): bool => $datum === 1,
28+
true,
29+
];
30+
yield [
31+
[1, 2, 3],
32+
static fn($datum): bool => $datum === 4,
33+
false,
34+
];
35+
yield [
36+
['abc', 'def', 'some test'],
37+
static fn(string $datum, int $key): bool => $datum === 'def' && $key === 1,
38+
true,
39+
];
40+
yield [
41+
['abc', 'def', 'some test'],
42+
static fn(string $datum, int $key): bool => $datum === 'def' && $key === 2,
43+
false,
4544
];
4645
}
4746

@@ -55,29 +54,27 @@ public function testTwice(array $data, callable $filter, bool $expected): void
5554
}
5655

5756
// phpcs:disable
58-
public static function twiceDataProvider(): array
57+
public static function twiceDataProvider(): Iterator
5958
{
60-
return [
61-
[
62-
[1, "1", 2],
63-
static fn($datum): bool => $datum == 1,
64-
true,
65-
],
66-
[
67-
[1, "1", 3],
68-
static fn($datum): bool => $datum === 1,
69-
false,
70-
],
71-
[
72-
['abc', 'def', 'some test'],
73-
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 0,
74-
true
75-
],
76-
[
77-
['abc', 'def', 'some test'],
78-
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 1,
79-
false
80-
],
59+
yield [
60+
[1, "1", 2],
61+
static fn($datum): bool => $datum == 1,
62+
true,
63+
];
64+
yield [
65+
[1, "1", 3],
66+
static fn($datum): bool => $datum === 1,
67+
false,
68+
];
69+
yield [
70+
['abc', 'def', 'some test'],
71+
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 0,
72+
true
73+
];
74+
yield [
75+
['abc', 'def', 'some test'],
76+
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 1,
77+
false
8178
];
8279
}
8380

@@ -91,29 +88,27 @@ public function testTimes(array $data, callable $filter, bool $expected): void
9188
);
9289
}
9390

94-
public static function timesDataProvider(): array
91+
public static function timesDataProvider(): Iterator
9592
{
96-
return [
97-
[
98-
[0, false, null],
99-
static fn($datum): bool => ! $datum,
100-
true,
101-
],
102-
[
103-
[1, false, null],
104-
static fn($datum): bool => ! $datum,
105-
false,
106-
],
107-
[
108-
['abc', 'def', 'some test', 'another test'],
109-
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 0,
110-
true,
111-
],
112-
[
113-
['abc', 'def', 'some test', 'another test'],
114-
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 1,
115-
false,
116-
],
93+
yield [
94+
[0, false, null],
95+
static fn($datum): bool => ! $datum,
96+
true,
97+
];
98+
yield [
99+
[1, false, null],
100+
static fn($datum): bool => ! $datum,
101+
false,
102+
];
103+
yield [
104+
['abc', 'def', 'some test', 'another test'],
105+
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 0,
106+
true,
107+
];
108+
yield [
109+
['abc', 'def', 'some test', 'another test'],
110+
static fn(string $datum, int $key): bool => $datum !== 'abc' && $key > 1,
111+
false,
117112
];
118113
}
119114
}

0 commit comments

Comments
 (0)