Skip to content

Commit

Permalink
styles: Enable PHP-CS-Fixer array_indentation rule
Browse files Browse the repository at this point in the history
Related to #1929. This rule required more manual fixing.
  • Loading branch information
theofidry committed Mar 19, 2024
1 parent 2885cf9 commit 0cd0892
Show file tree
Hide file tree
Showing 27 changed files with 131 additions and 132 deletions.
47 changes: 23 additions & 24 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,30 @@
'@PHPUnit75Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
// TODO: enable
'array_indentation' => false,
'array_indentation' => true,
'blank_line_before_statement' => false,
// TODO: enable back
// 'blank_line_before_statement' => [
// 'statements' => [
// 'break',
// 'continue',
// 'declare',
// 'do',
// 'for',
// 'foreach',
// 'if',
// 'include',
// 'include_once',
// 'require',
// 'require_once',
// 'return',
// 'switch',
// 'throw',
// 'try',
// 'while',
// 'yield',
// ],
// ],
// TODO: enable back
// 'blank_line_before_statement' => [
// 'statements' => [
// 'break',
// 'continue',
// 'declare',
// 'do',
// 'for',
// 'foreach',
// 'if',
// 'include',
// 'include_once',
// 'require',
// 'require_once',
// 'return',
// 'switch',
// 'throw',
// 'try',
// 'while',
// 'yield',
// ],
// ],
'blank_line_between_import_groups' => false,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
Expand Down
2 changes: 1 addition & 1 deletion src/Differ/DiffSourceCodeMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
final class DiffSourceCodeMatcher
{
private const POSSIBLE_DELIMITERS = [
'#', '%', ':', ';', '=', '?', '@', '^', '~',
'#', '%', ':', ';', '=', '?', '@', '^', '~',
];

public function matches(string $diff, string $sourceCodeRegex): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/GitHubAnnotationsLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getLogLines(): array
{$escapedExecutionResult->getMutantDiff()}
TEXT
,
,
];
$lines[] = $this->buildAnnotation(
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/GitLabCodeQualityLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getLogLines(): array
'location' => [
'path' => Path::makeRelative($escapedExecutionResult->getOriginalFilePath(), $projectRootDirectory),
'lines' => [
'begin' => $escapedExecutionResult->getOriginalStartingLine(),
'begin' => $escapedExecutionResult->getOriginalStartingLine(),
],
],
'severity' => 'major',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function codeProvider(): iterable
PHP
,
false, // Cannot detect this one since the call is not fully-qualified and there is no
// use statements - too tricky to detect
// use statements - too tricky to detect
];

yield 'core function - use statement' => [
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/Differ/DiffSourceCodeMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ public function hello() : string
+ $a - 2 + $this->getString(); # comment
DIFF
,
true,
true,
];

yield 'Regex containing less common delimiters should not lead to syntax error' => [
'.*%.*',
<<<'DIFF'
<<<'DIFF'
--- Original
+++ New
@@ @@
- $a % 2;
+ $a % 3;
DIFF
,
true,
,
true,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ public function test_it_sets_test_framework_version_as_unknown_in_case_of_except
$output->expects($this->once())
->method('writeln')
->with([
'',
'Running initial test suite...',
'',
'PHPUnit version: unknown',
'',
]);
'',
'Running initial test suite...',
'',
'PHPUnit version: unknown',
'',
]);
$output->method('getVerbosity')
->willReturn(OutputInterface::VERBOSITY_QUIET);

Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/Logger/GitLabCodeQualityLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function metricsProvider(): iterable
'location' => [
'path' => 'foo/bar',
'lines' => [
'begin' => 9,
'begin' => 9,
],
],
'severity' => 'major',
Expand All @@ -100,7 +100,7 @@ public static function metricsProvider(): iterable
'location' => [
'path' => 'foo/bar',
'lines' => [
'begin' => 10,
'begin' => 10,
],
],
'severity' => 'major',
Expand All @@ -121,7 +121,7 @@ public static function metricsProvider(): iterable
'location' => [
'path' => 'foo/bar',
'lines' => [
'begin' => 10,
'begin' => 10,
],
],
'severity' => 'major',
Expand Down
14 changes: 7 additions & 7 deletions tests/phpunit/Metrics/TargetDetectionStatusesProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public function test_it_ignores_some_statuses_when_debugging_is_not_enabled_for_
$provider = new TargetDetectionStatusesProvider($logs, LogVerbosity::NORMAL, false, false);

$this->assertProvidesExcluding([
DetectionStatus::KILLED,
DetectionStatus::ERROR,
],
DetectionStatus::KILLED,
DetectionStatus::ERROR,
],
$provider->get(),
);
}
Expand All @@ -120,10 +120,10 @@ public function test_it_ignores_more_statuses_when_running_in_only_covered_mode_
$provider = new TargetDetectionStatusesProvider($logs, LogVerbosity::NORMAL, true, false);

$this->assertProvidesExcluding([
DetectionStatus::KILLED,
DetectionStatus::ERROR,
DetectionStatus::NOT_COVERED,
],
DetectionStatus::KILLED,
DetectionStatus::ERROR,
DetectionStatus::NOT_COVERED,
],
$provider->get(),
);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/Mutator/Arithmetic/DivisionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ public function test_it_can_mutate(string $input, $expected = []): void
public static function mutationsProvider(): iterable
{
yield 'It changes regular divison' => [
<<<'PHP'
<<<'PHP'
<?php
$a = 10 / 2;
PHP
,
<<<'PHP'
,
<<<'PHP'
<?php
$a = 10 * 2;
PHP,
];

yield 'It does not change division equals' => [
<<<'PHP'
<<<'PHP'
<?php
$a = 10;
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/Mutator/Arithmetic/MultiplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ public function test_it_can_mutate(string $input, $expected = []): void
public static function mutationsProvider(): iterable
{
yield 'It mutates normal multiplication' => [
<<<'PHP'
<<<'PHP'
<?php
$a = 10 * 3;
PHP
,
<<<'PHP'
,
<<<'PHP'
<?php
$a = 10 / 3;
PHP,
];

yield 'It does not mutate multiplication equals' => [
<<<'PHP'
<<<'PHP'
<?php
$a = 1;
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/Mutator/Arithmetic/RoundingFamilyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public static function mutationsProvider(): iterable
$var = floor(1.23);
PHP
,
<<<'PHP'
,
<<<'PHP'
<?php
$var = ceil(1.23);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Mutator/Arithmetic/ShiftLeftTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function mutationsProvider(): iterable
];

yield 'It does not mutate shift right' => [
<<<'PHP'
<<<'PHP'
<?php
$a = 1;
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/Mutator/Boolean/InstanceOf_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ public static function mutationsProvider(): iterable
return someFunc(true);
PHP
,
,
<<<'PHP'
<?php
return someFunc(false);
PHP
,
,
],
];
}
Expand Down
Loading

0 comments on commit 0cd0892

Please sign in to comment.