diff --git a/packages/coding-standard/README.md b/packages/coding-standard/README.md index 663db6542d..641fb72380 100644 --- a/packages/coding-standard/README.md +++ b/packages/coding-standard/README.md @@ -29,8 +29,8 @@ includes: ## Rules Overview -- [PHP_CodeSniffer Sniffs](/docs/php_code_sniffer_sniffs.md) -- [PHP CS Fixer Fixers](/docs/phpcs_fixer_fixers.md) +- [PHP_CodeSniffer sniffs](/docs/php_code_sniffer_sniffs.md) +- [PHP CS Fixer fixers](/docs/phpcs_fixer_fixers.md) - [PHPStan rules](/docs/phpstan_rules.md) - [Object Calisthenics rules](/docs/phpstan_rules.md#object-calisthenics-rules) - [Cognitive Complexity rules](/docs/phpstan_rules.md#cognitive-complexity) diff --git a/packages/coding-standard/docs/php_code_sniffer_sniffs.md b/packages/coding-standard/docs/php_code_sniffer_sniffs.md index aa69fde358..ed4d0629a1 100644 --- a/packages/coding-standard/docs/php_code_sniffer_sniffs.md +++ b/packages/coding-standard/docs/php_code_sniffer_sniffs.md @@ -2,7 +2,7 @@ ## There should not be comments with valid code -- class: [`Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff`](src/Sniffs/Debug/CommentedOutCodeSniff.php) +- class: [`Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff`](../src/Sniffs/Debug/CommentedOutCodeSniff.php) ```php &Tokens $tokens */ protected function fixAnnotations(Tokens $tokens): void { $tokenCount = $tokens->count(); - $this->indentCounter = 0; - // what about foreach? for ($index = 0; $index < $tokenCount; ++$index) { /** @var Token $currentToken */ @@ -64,8 +66,6 @@ protected function fixAnnotations(Tokens $tokens): void continue; } - ++$this->indentCounter; - // docblock opener → skip it if ($previousToken->isType(DocLexer::T_NONE)) { continue; @@ -75,9 +75,6 @@ protected function fixAnnotations(Tokens $tokens): void throw new NotImplementedYetException(); } - // add a newline with indent - @todo resolve indent and removing of spaces - $indentWhitespace = str_repeat(' ', ($this->indentCounter - 1) * 4); - $tokens->insertAt($index, new Token(DocLexer::T_NONE, $indentWhitespace)); $tokens->insertAt($index, new Token(DocLexer::T_NONE, ' * ')); $tokens->insertAt($index, new Token(DocLexer::T_NONE, "\n")); diff --git a/packages/coding-standard/tests/Fixer/Annotation/NewlineInNestedAnnotationFixer/Fixture/basic_annotation_join.php.inc b/packages/coding-standard/tests/Fixer/Annotation/NewlineInNestedAnnotationFixer/Fixture/basic_annotation_join.php.inc index 5265e3a31c..1c4669ce7d 100644 --- a/packages/coding-standard/tests/Fixer/Annotation/NewlineInNestedAnnotationFixer/Fixture/basic_annotation_join.php.inc +++ b/packages/coding-standard/tests/Fixer/Annotation/NewlineInNestedAnnotationFixer/Fixture/basic_annotation_join.php.inc @@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping as ORM; /** * @ORM\Table(name="user", indexes={ - * @ORM\Index(name="user_id", columns={"another_id"}) + * @ORM\Index(name="user_id", columns={"another_id"}) * }) */ class SomeEntity diff --git a/packages/easy-coding-standard/config/set/doctrine-annotations.php b/packages/easy-coding-standard/config/set/doctrine-annotations.php index 0eb1239663..2e189fc3d6 100644 --- a/packages/easy-coding-standard/config/set/doctrine-annotations.php +++ b/packages/easy-coding-standard/config/set/doctrine-annotations.php @@ -12,6 +12,8 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); + $services->set(NewlineInNestedAnnotationFixer::class); + $services->set(DoctrineAnnotationIndentationFixer::class) ->call('configure', [[ 'indent_mixed_lines' => true, @@ -25,5 +27,4 @@ ]]); $services->set(DoctrineAnnotationArrayAssignmentFixer::class); - $services->set(NewlineInNestedAnnotationFixer::class); }; diff --git a/packages/set-config-resolver/src/SetResolver.php b/packages/set-config-resolver/src/SetResolver.php index 9d20609b28..4af80b2da6 100644 --- a/packages/set-config-resolver/src/SetResolver.php +++ b/packages/set-config-resolver/src/SetResolver.php @@ -13,11 +13,6 @@ final class SetResolver { - /** - * @var string[] - */ - private const OPTION_NAMES = OptionName::SET; - /** * @var OptionValueResolver */ @@ -36,7 +31,7 @@ public function __construct(SetProviderInterface $setProvider) public function detectFromInput(InputInterface $input): ?SmartFileInfo { - $setName = $this->optionValueResolver->getOptionValue($input, self::OPTION_NAMES); + $setName = $this->optionValueResolver->getOptionValue($input, OptionName::SET); if ($setName === null) { return null; }