Skip to content

Commit e5e3b08

Browse files
committed
PSR2/ClassDeclaration: add tests covering the CloseBraceSameLine error
Previously, there were no dedicated tests for the `CloseBraceSameLine` error.
1 parent 64c2c23 commit e5e3b08

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/Standards/PSR2/Tests/Classes/ClassDeclarationUnitTest.inc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,18 @@ class ClassWithMultiLineImplementsAndCommentOnSameLineAsInterfaceName implements
316316
/* Comment. */ AnotherInterface
317317
{
318318
}
319+
320+
// Verify the `CloseBraceSameLine` error code is thrown when expected.
321+
class ClassBraceNotOnLineByItselfError
322+
{
323+
public $prop;
324+
} $foo = new ClassBraceNotOnLineByItselfError;
325+
326+
interface ClassBraceNotOnLineByItselfTrailingCommentIsAllowed
327+
{
328+
public function myMethod();
329+
} //end interface -- this comment is allowed.
330+
331+
trait ClassBraceNotOnLineByItselfTrailingAnnotationIsAllowed
332+
{
333+
} // phpcs:ignore Stnd.Cat.Sniff -- this comment is also allowed.

src/Standards/PSR2/Tests/Classes/ClassDeclarationUnitTest.inc.fixed

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,18 @@ class ClassWithMultiLineImplementsAndCommentOnSameLineAsInterfaceName implements
305305
AnotherInterface
306306
{
307307
}
308+
309+
// Verify the `CloseBraceSameLine` error code is thrown when expected.
310+
class ClassBraceNotOnLineByItselfError
311+
{
312+
public $prop;
313+
} $foo = new ClassBraceNotOnLineByItselfError;
314+
315+
interface ClassBraceNotOnLineByItselfTrailingCommentIsAllowed
316+
{
317+
public function myMethod();
318+
} //end interface -- this comment is allowed.
319+
320+
trait ClassBraceNotOnLineByItselfTrailingAnnotationIsAllowed
321+
{
322+
} // phpcs:ignore Stnd.Cat.Sniff -- this comment is also allowed.

src/Standards/PSR2/Tests/Classes/ClassDeclarationUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function getErrorList()
7878
282 => 1,
7979
310 => 1,
8080
316 => 1,
81+
324 => 1,
8182
];
8283

8384
}//end getErrorList()

0 commit comments

Comments
 (0)