Skip to content

Commit

Permalink
StandaloneLinePromotedPropertyFixer should apply when there's only on…
Browse files Browse the repository at this point in the history
…e promoted property. (#44)
  • Loading branch information
gnutix committed Apr 4, 2024
1 parent 1a591e1 commit 50599e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function breakItems(BlockInfo $blockInfo, Tokens $tokens, int $kind): voi
);

// again, from the bottom to the top
for ($i = $blockInfo->getEnd() - 1; $i > $blockInfo->getStart(); --$i) {
for ($i = $blockInfo->getEnd() - 1; $i >= $blockInfo->getStart(); --$i) {
/** @var Token $currentToken */
$currentToken = $tokens[$i];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\StandaloneLinePromotedPropertyFixer\Fixture;

final class PromotedProperties
{
public function __construct(public int $age)
{
}
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\StandaloneLinePromotedPropertyFixer\Fixture;

final class PromotedProperties
{
public function __construct(
public int $age
)
{
}
}

?>

0 comments on commit 50599e1

Please sign in to comment.