From 914fe3017aa0c013a3e5ee0f314bf899bfcf95f3 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Mon, 4 Mar 2024 21:30:23 +0100 Subject: [PATCH 1/3] feat: `StatementIndentationFixer` - handle monolithic php only --- src/Fixer/Whitespace/StatementIndentationFixer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fixer/Whitespace/StatementIndentationFixer.php b/src/Fixer/Whitespace/StatementIndentationFixer.php index 783ec506397..101f142ff48 100644 --- a/src/Fixer/Whitespace/StatementIndentationFixer.php +++ b/src/Fixer/Whitespace/StatementIndentationFixer.php @@ -106,7 +106,7 @@ public function getPriority(): int public function isCandidate(Tokens $tokens): bool { - return true; + return $tokens->isMonolithicPhp(); } protected function createConfigurationDefinition(): FixerConfigurationResolverInterface From 218e0035ab53a7228489455c5905d9b6cc0ba4b6 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Mon, 4 Mar 2024 22:01:38 +0100 Subject: [PATCH 2/3] fix tests --- tests/Fixer/Basic/BracesFixerTest.php | 87 ++++----------------------- 1 file changed, 13 insertions(+), 74 deletions(-) diff --git a/tests/Fixer/Basic/BracesFixerTest.php b/tests/Fixer/Basic/BracesFixerTest.php index 10606ebf314..9587f16d269 100644 --- a/tests/Fixer/Basic/BracesFixerTest.php +++ b/tests/Fixer/Basic/BracesFixerTest.php @@ -1404,7 +1404,7 @@ function mixedComplex() yield [ 'x', 'x', ]; @@ -2437,7 +2437,7 @@ function mixedComplex() yield [ 'x', 'x', self::CONFIGURATION_OOP_POSITION_SAME_LINE, @@ -3234,10 +3234,6 @@ public static function provideFixCommentBeforeBraceCases(): iterable yield [ '', - '', @@ -5418,63 +5414,6 @@ public static function provideMessyWhitespacesCases(): iterable ]; } - /** - * @dataProvider provideNowdocInTemplatesCases - */ - public function testNowdocInTemplates(string $expected, ?string $input = null): void - { - $this->doTest($expected, $input); - } - - public static function provideNowdocInTemplatesCases(): iterable - { - yield [ - <<<'EOT' - - - - - X X ', ' X ', ]; @@ -5843,25 +5782,25 @@ public static function provideFixAlternativeSyntaxCases(): iterable yield [ ' +foreach ($b as $c): ?> + for (;;): ?> + foreach ($b as $c): ?> + for (;;): ?> + while ($b): ?> + while ($b): ?> + foreach ($b as $c): ?> + for (;;): ?> + while ($b): ?> + while ($b): ?> Date: Mon, 4 Mar 2024 22:26:16 +0100 Subject: [PATCH 3/3] fix phpstan --- phpstan.dist.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 2998407dd5d..c0cca8b0baa 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -21,6 +21,6 @@ parameters: - message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#' path: tests - count: 1021 + count: 1020 tipsOfTheDay: false tmpDir: dev-tools/phpstan/cache