Skip to content

Commit 2cc69ae

Browse files
authored
fix(SpaceUnaryOperator): Fix support for __LINE__ symbol (#3350432)
1 parent 9bcbe0d commit 2cc69ae

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

coder_sniffer/Drupal/Sniffs/Formatting/SpaceUnaryOperatorSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public function process(File $phpcsFile, $stackPtr)
123123
T_CLOSE_SHORT_ARRAY,
124124
T_VARIABLE,
125125
T_STRING,
126+
T_LINE,
126127
]
127128
);
128129

tests/Drupal/Formatting/SpaceUnaryOperatorUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ $i ++;
55
$x = ! $i;
66
$x = - $x;
77
$i = + 1;
8+
$x = __LINE__ - 3;
9+
$x = 3 - __LINE__;

tests/Drupal/Formatting/SpaceUnaryOperatorUnitTest.inc.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ $i++;
99
$x = !$i;
1010
$x = -$x;
1111
$i = +1;
12+
$x = __LINE__ - 3;
13+
$x = 3 - __LINE__;

0 commit comments

Comments
 (0)