Skip to content

Commit 9de0717

Browse files
authored
Dev cleanup (#1033)
1 parent 6058a83 commit 9de0717

15 files changed

+34
-26
lines changed

.dev-tools/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"phpcbf || exit 0"
5252
],
5353
"infection": [
54-
"infection run --min-msi=100 --logger-github --no-progress --threads=16"
54+
"infection run --logger-github --no-progress --threads=16"
5555
]
5656
}
5757
}

.dev-tools/infection.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"configDir": "..",
1818
"customPath": "../vendor/phpunit/phpunit/phpunit"
1919
},
20+
"minCoveredMsi": 100,
2021
"mutators": {
2122
"ArrayAll": true,
2223
"ArrayAny": true,

.dev-tools/src/InfectionConfigBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function build(): array
5252
'configDir' => '..',
5353
'customPath' => '../vendor/phpunit/phpunit/phpunit',
5454
],
55+
'minCoveredMsi' => 100,
5556
'mutators' => [],
5657
];
5758

.dev-tools/src/Readme/ReadmeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ private function diff(string $from, string $to): string
269269

270270
private function createSplFileInfoDouble(): \SplFileInfo
271271
{
272-
return new class (\getcwd() . '/file.php') extends \SplFileInfo {
272+
return new class (\getcwd() . \DIRECTORY_SEPARATOR . 'file.php') extends \SplFileInfo {
273273
public function __construct(string $filename)
274274
{
275275
parent::__construct($filename);

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
$rules['trailing_comma_in_multiline'] = ['after_heredoc' => true, 'elements' => ['arguments', 'arrays']]; // TODO: remove when dropping support to PHP <8.0
6060

6161
$rules[PhpdocOnlyAllowedAnnotationsFixer::name()]['elements'][] = 'phpstan-type';
62+
$rules[PhpdocOnlyAllowedAnnotationsFixer::name()]['elements'][] = 'codeCoverageIgnore';
6263

6364
foreach (new PhpCsFixerCustomFixersDev\Fixers() as $fixer) {
6465
$rules[$fixer->getName()] = true;

tests/Fixer/AbstractFixerTestCase.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,19 @@ final protected static function getFixer(): FixerInterface
157157
}
158158

159159
/**
160-
* @param null|array<string, mixed> $configuration
160+
* @param array<string, mixed> $configuration
161161
*/
162-
final protected function doTest(string $expected, ?string $input = null, ?array $configuration = null): void
162+
final protected function doTest(string $expected, ?string $input = null, array $configuration = [], ?WhitespacesFixerConfig $whitespacesFixerConfig = null): void
163163
{
164164
$fixer = self::getFixer();
165165

166166
if ($fixer instanceof ConfigurableFixerInterface) {
167-
$fixer->configure($configuration ?? []);
167+
$fixer->configure($configuration);
168+
}
169+
170+
if ($whitespacesFixerConfig instanceof WhitespacesFixerConfig) {
171+
self::assertInstanceOf(WhitespacesAwareFixerInterface::class, $fixer);
172+
$fixer->setWhitespacesConfig($whitespacesFixerConfig);
168173
}
169174

170175
if ($expected === $input) {
@@ -250,7 +255,7 @@ final protected function assertSuccessorName(string $successorName): void
250255

251256
private function createSplFileInfoDouble(): \SplFileInfo
252257
{
253-
return new class (\getcwd() . '/src/file.php') extends \SplFileInfo {
258+
return new class (\getcwd() . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . 'FixerFile.php') extends \SplFileInfo {
254259
public function __construct(string $filename)
255260
{
256261
parent::__construct($filename);

tests/Fixer/CommentedOutFunctionFixerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function testIsRisky(): void
3131
}
3232

3333
/**
34-
* @param null|array<string, list<string>> $configuration
34+
* @param array<string, list<string>> $configuration
3535
*
3636
* @dataProvider provideFixCases
3737
*/
38-
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
38+
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
3939
{
4040
$this->doTest($expected, $input, $configuration);
4141
}

tests/Fixer/DataProviderNameFixerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function testSuccessorName(): void
4040
}
4141

4242
/**
43-
* @param null|array<string, string> $configuration
43+
* @param array<string, string> $configuration
4444
*
4545
* @dataProvider provideFixCases
4646
*/
47-
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
47+
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
4848
{
4949
$this->doTest($expected, $input, $configuration);
5050
}

tests/Fixer/DataProviderStaticFixerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function testConfiguration(): void
3636
}
3737

3838
/**
39-
* @param null|array<string, bool> $configuration
39+
* @param array<string, bool> $configuration
4040
*
4141
* @dataProvider provideFixCases
4242
*/
43-
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
43+
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
4444
{
4545
$this->doTest($expected, $input, $configuration);
4646
}

tests/Fixer/NoDuplicatedArrayKeyFixerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function testConfiguration(): void
3131
}
3232

3333
/**
34-
* @param null|array<string, bool> $configuration
34+
* @param array<string, bool> $configuration
3535
*
3636
* @dataProvider provideFixCases
3737
*/
38-
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
38+
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
3939
{
4040
$this->doTest($expected, $input, $configuration);
4141
}

0 commit comments

Comments
 (0)