Skip to content

Commit 95904f3

Browse files
committed
WhiteSpace/OperatorSpacing: add extra test
Upstream a PR is open - and will be merged soon - to change the protection against the `Squiz` sniff, which this sniff extends, handling operators found in `declare()` statements. In particular, the PR is about how the sniff handles parse errors/live coding for declare statements. As the WPCS sniff calls the parent `register()` method and falls through to the parent `process()` method, the WPCS sniff should automatically get that extra protection too. This commit just adds an extra test to the `WordPress.WhiteSpace.OperatorSpacing` to safeguard things.
1 parent d15a466 commit 95904f3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: WordPress/Tests/WhiteSpace/OperatorSpacingUnitTest.inc

+4
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ function fooBar( TypeA&namespace\TypeB $param ) : \TypeC&Partially\Qualified {}
7575
class Foo {
7676
public readonly int|string $prop;
7777
}
78+
79+
// Safeguard that declare statements are ignored.
80+
// Ref: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/289
81+
declare(ticks=1);

Diff for: WordPress/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed

+4
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ function fooBar( TypeA&namespace\TypeB $param ) : \TypeC&Partially\Qualified {}
7575
class Foo {
7676
public readonly int|string $prop;
7777
}
78+
79+
// Safeguard that declare statements are ignored.
80+
// Ref: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/289
81+
declare(ticks=1);

0 commit comments

Comments
 (0)