Skip to content

Commit 7e4089d

Browse files
committed
Merge branch 'fix-operators-sniff' of https://github.com/grongor/PHP_CodeSniffer
2 parents c090358 + d208a21 commit 7e4089d

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function register()
5555
$targets += Tokens::$assignmentTokens;
5656
$targets[] = T_INLINE_THEN;
5757
$targets[] = T_INLINE_ELSE;
58+
$targets[] = T_INSTANCEOF;
5859

5960
return $targets;
6061

src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,5 +261,9 @@ if ($line{-1} === ':') {
261261
$line = substr($line, 0, -1);
262262
}
263263

264+
$a = $a instanceof $b;
265+
$a = $a instanceof $b;
266+
$a = ($a)instanceof$b;
267+
264268
// phpcs:set Squiz.WhiteSpace.OperatorSpacing ignoreSpacingBeforeAssignments false
265269
$a = 3;

src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,5 +255,9 @@ if ($line{-1} === ':') {
255255
$line = substr($line, 0, -1);
256256
}
257257

258+
$a = $a instanceof $b;
259+
$a = $a instanceof $b;
260+
$a = ($a) instanceof $b;
261+
258262
// phpcs:set Squiz.WhiteSpace.OperatorSpacing ignoreSpacingBeforeAssignments false
259263
$a = 3;

src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public function getErrorList($testFile='OperatorSpacingUnitTest.inc')
9797
239 => 1,
9898
246 => 1,
9999
265 => 2,
100+
266 => 2,
101+
269 => 2,
100102
];
101103
break;
102104
case 'OperatorSpacingUnitTest.js':

0 commit comments

Comments
 (0)