Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"phpcbf || exit 0"
],
"infection": [
"infection run --min-msi=100 --logger-github --no-progress --threads=16"
"infection run --logger-github --no-progress --threads=16"
]
}
}
1 change: 1 addition & 0 deletions .dev-tools/infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"configDir": "..",
"customPath": "../vendor/phpunit/phpunit/phpunit"
},
"minCoveredMsi": 100,
"mutators": {
"ArrayAll": true,
"ArrayAny": true,
Expand Down
1 change: 1 addition & 0 deletions .dev-tools/src/InfectionConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function build(): array
'configDir' => '..',
'customPath' => '../vendor/phpunit/phpunit/phpunit',
],
'minCoveredMsi' => 100,
'mutators' => [],
];

Expand Down
2 changes: 1 addition & 1 deletion .dev-tools/src/Readme/ReadmeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private function diff(string $from, string $to): string

private function createSplFileInfoDouble(): \SplFileInfo
{
return new class (\getcwd() . '/file.php') extends \SplFileInfo {
return new class (\getcwd() . \DIRECTORY_SEPARATOR . 'file.php') extends \SplFileInfo {
public function __construct(string $filename)
{
parent::__construct($filename);
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
$rules['trailing_comma_in_multiline'] = ['after_heredoc' => true, 'elements' => ['arguments', 'arrays']]; // TODO: remove when dropping support to PHP <8.0

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

foreach (new PhpCsFixerCustomFixersDev\Fixers() as $fixer) {
$rules[$fixer->getName()] = true;
Expand Down
13 changes: 9 additions & 4 deletions tests/Fixer/AbstractFixerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,19 @@ final protected static function getFixer(): FixerInterface
}

/**
* @param null|array<string, mixed> $configuration
* @param array<string, mixed> $configuration
*/
final protected function doTest(string $expected, ?string $input = null, ?array $configuration = null): void
final protected function doTest(string $expected, ?string $input = null, array $configuration = [], ?WhitespacesFixerConfig $whitespacesFixerConfig = null): void
{
$fixer = self::getFixer();

if ($fixer instanceof ConfigurableFixerInterface) {
$fixer->configure($configuration ?? []);
$fixer->configure($configuration);
}

if ($whitespacesFixerConfig instanceof WhitespacesFixerConfig) {
self::assertInstanceOf(WhitespacesAwareFixerInterface::class, $fixer);
$fixer->setWhitespacesConfig($whitespacesFixerConfig);
}

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

private function createSplFileInfoDouble(): \SplFileInfo
{
return new class (\getcwd() . '/src/file.php') extends \SplFileInfo {
return new class (\getcwd() . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . 'FixerFile.php') extends \SplFileInfo {
public function __construct(string $filename)
{
parent::__construct($filename);
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/CommentedOutFunctionFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function testIsRisky(): void
}

/**
* @param null|array<string, list<string>> $configuration
* @param array<string, list<string>> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/DataProviderNameFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function testSuccessorName(): void
}

/**
* @param null|array<string, string> $configuration
* @param array<string, string> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/DataProviderStaticFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function testConfiguration(): void
}

/**
* @param null|array<string, bool> $configuration
* @param array<string, bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/NoDuplicatedArrayKeyFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function testConfiguration(): void
}

/**
* @param null|array<string, bool> $configuration
* @param array<string, bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Fixer/NoSuperfluousConcatenationFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function testConfiguration(): void
}

/**
* @param null|array<string, bool> $configuration
* @param array<string, bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testStringIsTheSame(string $expected, ?string $input = null, ?array $configuration = null): void
public function testStringIsTheSame(string $expected, ?string $input = null, array $configuration = []): void
{
if ($input === null) {
$this->expectNotToPerformAssertions();
Expand All @@ -48,11 +48,11 @@ public function testStringIsTheSame(string $expected, ?string $input = null, ?ar
}

/**
* @param null|array<string, bool> $configuration
* @param array<string, bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest(
'<?php ' . $expected . ';',
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/NumericLiteralSeparatorFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public function testReversingCodeSample(): void
}

/**
* @param null|array<string, null|bool> $configuration
* @param array<string, null|bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest(
$expected,
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/PhpdocOnlyAllowedAnnotationsFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function testIsRisky(): void
}

/**
* @param null|array<string, list<string>> $configuration
* @param array<string, list<string>> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/PromotedConstructorPropertyFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public function testIsRisky(): void
}

/**
* @param null|array<string, list<string>> $configuration
* @param array<string, list<string>> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/SingleSpaceAfterStatementFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ public function testIsRisky(): void
}

/**
* @param null|array<string, bool> $configuration
* @param array<string, bool> $configuration
*
* @dataProvider provideFixCases
*/
public function testFix(string $expected, ?string $input = null, ?array $configuration = null): void
public function testFix(string $expected, ?string $input = null, array $configuration = []): void
{
$this->doTest($expected, $input, $configuration);
}
Expand Down