Skip to content

Commit

Permalink
Add test to demonstrate a bug in MemberVarSpacing
Browse files Browse the repository at this point in the history
  • Loading branch information
asispts committed Jun 9, 2023
1 parent a29d4e6 commit 8f61b28
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Bugs/Squiz/MemberVarSpacingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php declare(strict_types=1);

namespace Ptscs\Tests\Bugs\Squiz;

use Iterator;
use Ptscs\Tests\SniffTestCase;
use Ptscs\Tests\Utils\ErrorData;

final class MemberVarSpacingTest extends SniffTestCase
{
protected function setUp(): void
{
$this->appendExclude('Squiz.Classes.ClassFileName');
}

public static function provideTestData(): Iterator
{
yield[
[
new ErrorData(5, 'Squiz.WhiteSpace.MemberVarSpacing.AfterComment'),
new ErrorData(16, 'Squiz.WhiteSpace.MemberVarSpacing.Incorrect'),
new ErrorData(28, 'Squiz.WhiteSpace.MemberVarSpacing.Incorrect'),
],
];
}
}
23 changes: 23 additions & 0 deletions tests/Bugs/Squiz/_data/MemberVarSpacing.php.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

final class MemberVar
{
// phpcs can fix this but not the next one
#[SingleAttribute]
public $property1;

#[SingleAttribute]




public $property2;

#[SingleAttribute]





public $property3;
}
29 changes: 29 additions & 0 deletions tests/Bugs/Squiz/_data/MemberVarSpacing.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

final class MemberVar
{
// phpcs can fix this but not the next one

#[SingleAttribute]


public $property1;
#[SingleAttribute]




public $property2;





#[SingleAttribute]





public $property3;
}

0 comments on commit 8f61b28

Please sign in to comment.