Skip to content

Commit

Permalink
relax: Add property-read & property-write to phpdoc_align
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Jul 31, 2024
1 parent 7df7e16 commit c56a934
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/RuleSet/Sets/Relax.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public function mainRules(): array
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']],
'unary_operator_spaces' => ['only_dec_inc' => true],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'phpdoc_align' => ['tags' => ['method', 'param', 'property', 'throws', 'type', 'var']],
'phpdoc_align' => [
'tags' => ['method', 'param', 'property', 'property-read', 'property-write', 'throws', 'type', 'var'],
],
'phpdoc_separation' => [
'groups' => [
['param', 'param-out', 'return'], ['var', 'readonly'],
Expand Down
16 changes: 16 additions & 0 deletions tests/Fixtures/Ruleset/relax-commonbox_actual.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ protected function foo()
}
}

/**
* phpdoc_align
*
* @property int $a
* @property-read null|int $b
* @property-write string $c
*/
class PhpdocAlign
{
/**
* @param string $a
* @param int $b
*/
public function phpdoc__phpdoc_align($a, $b) {}
}

/**
* braces_position
*/
Expand Down
16 changes: 16 additions & 0 deletions tests/Fixtures/Ruleset/relax-commonbox_expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ class NoBlankLinesAfterClassOpening
protected function foo() {}
}

/**
* phpdoc_align
*
* @property int $a
* @property-read null|int $b
* @property-write string $c
*/
class PhpdocAlign
{
/**
* @param string $a
* @param int $b
*/
public function phpdoc__phpdoc_align($a, $b) {}
}

/**
* braces_position
*/
Expand Down
6 changes: 0 additions & 6 deletions tests/Fixtures/Ruleset/relax_actual.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,6 @@ public function phpdoc__no_empty_phpdoc()
*/
public function phpdoc__no_superfluous_phpdoc_tags($foo /*, $hidden_params = null */) {}

/**
* @param string $a
* @param int $b
*/
public function phpdoc__phpdoc_align($a, $b) {}

/**
* @internal
* @access private
Expand Down
6 changes: 0 additions & 6 deletions tests/Fixtures/Ruleset/relax_expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,6 @@ public function phpdoc__no_empty_phpdoc() {}
*/
public function phpdoc__no_superfluous_phpdoc_tags($foo /* , $hidden_params = null */) {}

/**
* @param string $a
* @param int $b
*/
public function phpdoc__phpdoc_align($a, $b) {}

/**
* @internal
*/
Expand Down

0 comments on commit c56a934

Please sign in to comment.