Skip to content

Commit

Permalink
minor #6174 PhpdocAlignFixer: fix property-read/property-write descri…
Browse files Browse the repository at this point in the history
…ptions not getting aligned (antichris)

This PR was squashed before being merged into the master branch (closes #6174).

Discussion
----------

PhpdocAlignFixer: fix property-read/property-write descriptions not getting aligned

Although the PHPDoc descriptions of `@property` tags did get aligned vertically, the `@property-read` and `@property-write` ones didn't. Now they do.

This is done by adding `@property-read` and `@property-write` to the `TAGS_WITH_NAME` const array.

The `PhpdocAlignFixerTest::testVariadicParams()` case for magic `@property(...)` tags also now has the PHPDoc descriptions that were missing.

Feedback is very welcome, as always.

Commits
-------

9e13590 PhpdocAlignFixer: fix property-read/property-write descriptions not getting aligned
  • Loading branch information
SpacePossum committed Dec 15, 2021
2 parents 40c0419 + 9e13590 commit cf07446
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Fixer/Phpdoc/PhpdocAlignFixer.php
Expand Up @@ -64,6 +64,8 @@ final class PhpdocAlignFixer extends AbstractFixer implements ConfigurableFixerI
private const TAGS_WITH_NAME = [
'param',
'property',
'property-read',
'property-write',
];

private const TAGS_WITH_METHOD_SIGNATURE = [
Expand Down
12 changes: 6 additions & 6 deletions tests/Fixer/Phpdoc/PhpdocAlignFixerTest.php
Expand Up @@ -1227,17 +1227,17 @@ public function sample2($a, $b, ...$c)
['tags' => ['property', 'property-read', 'property-write']],
'<?php
/**
* @property string $myMagicProperty
* @property-read string $myMagicReadyProperty
* @property-write string $myMagicWriteProperty
* @property string $myMagicProperty magic property
* @property-read string $myMagicReadProperty magic read-only property
* @property-write string $myMagicWriteProperty magic write-only property
*/
class Foo {}
',
'<?php
/**
* @property string $myMagicProperty
* @property-read string $myMagicReadyProperty
* @property-write string $myMagicWriteProperty
* @property string $myMagicProperty magic property
* @property-read string $myMagicReadProperty magic read-only property
* @property-write string $myMagicWriteProperty magic write-only property
*/
class Foo {}
',
Expand Down

0 comments on commit cf07446

Please sign in to comment.