Skip to content

Commit

Permalink
minor #54 Group some PHPDoc tags in PhpdocSeparationFixer rule (coldic3)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3-dev branch.

Discussion
----------



Commits
-------

8163ed2 Group some PHPDoc tags in PhpdocSeparationFixer rule
  • Loading branch information
GSadee authored Mar 30, 2023
2 parents 95a4df6 + 8163ed2 commit a46aab4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer;
use PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer;
use PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
use PhpCsFixer\Fixer\ControlStructure\ElseifFixer;
use PhpCsFixer\Fixer\ControlStructure\IncludeFixer;
Expand Down Expand Up @@ -257,5 +258,10 @@
$ecsConfig->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, ['elements' => ['arrays', 'arguments', 'parameters']]);
$ecsConfig->ruleWithConfiguration(VisibilityRequiredFixer::class, ['elements' => ['const', 'property', 'method']]);

// ECS 10 issue
if (is_a(PhpdocSeparationFixer::class, ConfigurableFixerInterface::class, true)) {
$ecsConfig->ruleWithConfiguration(PhpdocSeparationFixer::class, ['groups' => [['Given', 'When', 'Then'], ['var', 'phpstan-var', 'psalm-var'], ['return', 'phpstan-return', 'psalm-return'], ['param', 'phpstan-param', 'psalm-param']]]);
}

$ecsConfig->skip([VisibilityRequiredFixer::class => ['*Spec.php']]);
};
32 changes: 32 additions & 0 deletions tests/Annotations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Tests\CodingStandard;

final class Annotations
{
/**
* @param int $bar
* @param string $baz
* @phpstan-param string $baz
* @psalm-param string $baz
*
* @return string[]
* @phpstan-return string<int, string>
* @psalm-return string<int, string>
*/
public function foo($bar, $baz)
{
/**
* Some comment
*
* @var int $key
* @phpstan-var int $key
* @psalm-var int $key
*/
$key = --$bar;

return [$key => $baz];
}
}

0 comments on commit a46aab4

Please sign in to comment.