File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
68
68
- Fixed bug #3157 : PSR2.ControlStructures.SwitchDeclaration.BreakIndent false positive when case keyword is not indented
69
69
- Fixed bug #3165 : Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure
70
70
- Fixed bug #3167 : Generic.WhiteSpace.ScopeIndent false positive when using PHP 8.0 constructor property promotion
71
+ - Fixed bug #3170 : Squiz.WhiteSpace.OperatorSpacing false positive when using negation with string concat
72
+ -- This also fixes the same issue in the PSR12.Operators.OperatorSpacing sniff
71
73
</notes>
72
74
<contents>
73
75
<dir name="/">
Original file line number Diff line number Diff line change @@ -87,15 +87,16 @@ public function register()
87
87
88
88
// Trying to use a negative value; eg. myFunction($var, -2).
89
89
$ this ->nonOperandTokens += [
90
- T_COMMA => T_COMMA ,
91
- T_OPEN_PARENTHESIS => T_OPEN_PARENTHESIS ,
92
- T_OPEN_SQUARE_BRACKET => T_OPEN_SQUARE_BRACKET ,
93
- T_OPEN_SHORT_ARRAY => T_OPEN_SHORT_ARRAY ,
90
+ T_CASE => T_CASE ,
94
91
T_COLON => T_COLON ,
95
- T_INLINE_THEN => T_INLINE_THEN ,
92
+ T_COMMA => T_COMMA ,
96
93
T_INLINE_ELSE => T_INLINE_ELSE ,
97
- T_CASE => T_CASE ,
94
+ T_INLINE_THEN => T_INLINE_THEN ,
98
95
T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ,
96
+ T_OPEN_PARENTHESIS => T_OPEN_PARENTHESIS ,
97
+ T_OPEN_SHORT_ARRAY => T_OPEN_SHORT_ARRAY ,
98
+ T_OPEN_SQUARE_BRACKET => T_OPEN_SQUARE_BRACKET ,
99
+ T_STRING_CONCAT => T_STRING_CONCAT ,
99
100
];
100
101
101
102
// Casting a negative value; eg. (array) -$a.
Original file line number Diff line number Diff line change @@ -472,5 +472,10 @@ $fn = fn ($boo =+1) => $boo;
472
472
473
473
$ fn = static fn (DateTime $ a , DateTime $ b ): int => -($ a ->getTimestamp () <=> $ b ->getTimestamp ());
474
474
475
+ $ a = 'a ' .-MY_CONSTANT ;
476
+ $ a = 'a ' .-$ b ;
477
+ $ a = 'a ' .- MY_CONSTANT ;
478
+ $ a = 'a ' .- $ b ;
479
+
475
480
/* Intentional parse error. This has to be the last test in the file. */
476
481
$ a = 10 +
Original file line number Diff line number Diff line change @@ -466,5 +466,10 @@ $fn = fn ($boo =+1) => $boo;
466
466
467
467
$fn = static fn(DateTime $a, DateTime $b): int => -($a->getTimestamp() <=> $b->getTimestamp());
468
468
469
+ $a = 'a '.-MY_CONSTANT;
470
+ $a = 'a '.-$b;
471
+ $a = 'a '.- MY_CONSTANT;
472
+ $a = 'a '.- $b;
473
+
469
474
/* Intentional parse error. This has to be the last test in the file. */
470
475
$a = 10 +
You can’t perform that action at this time.
0 commit comments