Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,16 @@
@ODM\,
@PHPCR\,
"/>
<element value="@param"/>
<element value="@return"/>
<element value="
@param,
@psalm-param,
@phpstan-param,
"/>
<element value="
@return,
@psalm-return,
@phpstan-return,
"/>
<element value="@throws"/>
</property>
</properties>
Expand Down
10 changes: 7 additions & 3 deletions tests/fixed/doc-comment-spacing.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ public function c(iterable $foo): void
* @PHPCR\Uuid
* @PHPCR\Field
*
* @param int[] $foo
* @param int[] $bar
* @param int[] $foo
* @param int[] $bar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended that parameter types are aligned regardless of the vendor prefix but the names aren't? Since we assume prefixed and non-prefixed to have the same meaning, I'd expect them to be aligned in the same way:

* @param         int[]              $foo
* @param         int[]              $bar
* @psalm-param   array<string, int> $foo
* @phpstan-param array<string, int> $foo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @morozov we discussed this here #238 (comment)
It is not possible from the phpcs package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are interested in having this formatting I am pretty sure adding another configuration option to phpcs shouldn't be too hard. But from the structure of the code I don't want to spend time getting into it to contribute there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's not the goal of this PR, would be a scope creep

* @psalm-param array<string, int> $foo
* @phpstan-param array<string, int> $foo
*
* @return int[]
* @return int[]
* @psalm-return array<string, int>
* @phpstan-return array<string, int>
*
* @throws FooException
* @throws BarException
Expand Down
10 changes: 7 additions & 3 deletions tests/input/doc-comment-spacing.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,24 @@ public function c(iterable $foo): void
* Description
* More Description
* @throws FooException
* @param int[] $foo
* @param int[] $foo
* @uses other
* @throws BarException
* @return int[]
* @return int[]
* @ORM\Id
* @internal
* @link https://example.com
* @ODM\Id
* @deprecated
* @PHPCR\Uuid
* @param int[] $bar
* @param int[] $bar
* @PHPCR\Field
* @ODM\Column
* @ORM\Column
* @psalm-param array<string, int> $foo
* @phpstan-return array<string, int>
* @phpstan-param array<string, int> $foo
* @psalm-return array<string, int>
* @see other
*
*/
Expand Down