From d5c68510eef03cb3591003504c9e8ed33649902c Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Mon, 13 Dec 2021 16:22:23 +0100 Subject: [PATCH] Update project CS --- doc/ruleSets/PhpCsFixer.rst | 2 +- doc/rules/whitespace/blank_line_before_statement.rst | 2 +- src/Console/Report/FixReport/JunitReporter.php | 1 + src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php | 1 + src/RuleSet/Sets/PhpCsFixerSet.php | 1 + tests/Fixer/Alias/NoAliasFunctionsFixerTest.php | 1 + tests/Tokenizer/TokensTest.php | 1 + 7 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/ruleSets/PhpCsFixer.rst b/doc/ruleSets/PhpCsFixer.rst index 6b35c813b91..46f79b6b31f 100644 --- a/doc/ruleSets/PhpCsFixer.rst +++ b/doc/ruleSets/PhpCsFixer.rst @@ -12,7 +12,7 @@ Rules - `array_indentation <./../rules/whitespace/array_indentation.rst>`_ - `blank_line_before_statement <./../rules/whitespace/blank_line_before_statement.rst>`_ config: - ``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]`` + ``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]`` - `combine_consecutive_issets <./../rules/language_construct/combine_consecutive_issets.rst>`_ - `combine_consecutive_unsets <./../rules/language_construct/combine_consecutive_unsets.rst>`_ - `empty_loop_body <./../rules/control_structure/empty_loop_body.rst>`_ diff --git a/doc/rules/whitespace/blank_line_before_statement.rst b/doc/rules/whitespace/blank_line_before_statement.rst index 297ffc7bff3..2c46e07d4a8 100644 --- a/doc/rules/whitespace/blank_line_before_statement.rst +++ b/doc/rules/whitespace/blank_line_before_statement.rst @@ -235,7 +235,7 @@ The rule is part of the following rule sets: @PhpCsFixer Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``blank_line_before_statement`` rule with the config below: - ``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]`` + ``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]`` @Symfony Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``blank_line_before_statement`` rule with the config below: diff --git a/src/Console/Report/FixReport/JunitReporter.php b/src/Console/Report/FixReport/JunitReporter.php index 114d3df86ef..1614f37ca94 100644 --- a/src/Console/Report/FixReport/JunitReporter.php +++ b/src/Console/Report/FixReport/JunitReporter.php @@ -43,6 +43,7 @@ public function generate(ReportSummary $reportSummary): string $dom = new \DOMDocument('1.0', 'UTF-8'); $testsuites = $dom->appendChild($dom->createElement('testsuites')); + /** @var \DomElement $testsuite */ $testsuite = $testsuites->appendChild($dom->createElement('testsuite')); $testsuite->setAttribute('name', 'PHP CS Fixer'); diff --git a/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php b/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php index 897bd1fc472..f6f7ab184f3 100644 --- a/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php +++ b/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php @@ -70,6 +70,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void } $newlineFound = false; + /** @var Token $token */ foreach ($tokens as $token) { if ($token->isWhitespace() && str_contains($token->getContent(), "\n")) { diff --git a/src/RuleSet/Sets/PhpCsFixerSet.php b/src/RuleSet/Sets/PhpCsFixerSet.php index 6bd37f60bb0..83e8b6f9643 100644 --- a/src/RuleSet/Sets/PhpCsFixerSet.php +++ b/src/RuleSet/Sets/PhpCsFixerSet.php @@ -38,6 +38,7 @@ public function getRules(): array 'goto', 'include', 'include_once', + 'phpdoc', 'require', 'require_once', 'return', diff --git a/tests/Fixer/Alias/NoAliasFunctionsFixerTest.php b/tests/Fixer/Alias/NoAliasFunctionsFixerTest.php index a22023da46a..c58336f4578 100644 --- a/tests/Fixer/Alias/NoAliasFunctionsFixerTest.php +++ b/tests/Fixer/Alias/NoAliasFunctionsFixerTest.php @@ -255,6 +255,7 @@ public function provideFix81Cases(): \Generator private function provideAllCases(): \Generator { $reflectionConstant = new \ReflectionClassConstant(\PhpCsFixer\Fixer\Alias\NoAliasFunctionsFixer::class, 'SETS'); + /** @var array $allAliases */ $allAliases = $reflectionConstant->getValue(); diff --git a/tests/Tokenizer/TokensTest.php b/tests/Tokenizer/TokensTest.php index 65edfe1bbcb..dd9aed11c5c 100644 --- a/tests/Tokenizer/TokensTest.php +++ b/tests/Tokenizer/TokensTest.php @@ -464,6 +464,7 @@ public function bar() } PHP; $tokens = Tokens::fromCode($source); + /** @var Token[] $found */ $found = $tokens->findGivenKind(T_CLASS); static::assertCount(1, $found);