Skip to content

Commit

Permalink
Fix PHPDoc line span fixer when property has array typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
ossinkine committed Nov 16, 2020
1 parent 9b6f77d commit 1901360
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Fixer/Phpdoc/PhpdocLineSpanFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ private function getDocBlockIndex(Tokens $tokens, $index)
T_STATIC,
T_STRING,
T_NS_SEPARATOR,
CT::T_ARRAY_TYPEHINT,
CT::T_NULLABLE_TYPE,
]));

Expand Down
21 changes: 21 additions & 0 deletions tests/Fixer/Phpdoc/PhpdocLineSpanFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,27 @@ class Foo
*
*/
private ?string $foo;
}',
[
'property' => 'single',
],
],
'It can handle properties with array type declaration' => [
'<?php
class Foo
{
/** @var string[] */
private array $foo;
}',
'<?php
class Foo
{
/**
* @var string[]
*/
private array $foo;
}',
[
'property' => 'single',
Expand Down

0 comments on commit 1901360

Please sign in to comment.