Skip to content

Commit 6b50008

Browse files
authored
Merge pull request #111 from doctrine/sniff/SpreadOperatorSpacing
Enable SpreadOperatorSpacing sniff
2 parents 7e110bb + 97990d6 commit 6b50008

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

lib/Doctrine/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
271271
<!-- Require the usage of assignment operators, eg `+=`, `.=` when possible -->
272272
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
273+
<!-- Require no spacing after spread operator -->
274+
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing"/>
273275
<!-- forbid argument unpacking for functions specialized by PHP VM -->
274276
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
275277
<!-- Forbid `list(...)` syntax -->

tests/expected_report.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ tests/input/optimized-functions.php 1 0
2323
tests/input/return_type_on_closures.php 21 0
2424
tests/input/return_type_on_methods.php 17 0
2525
tests/input/semicolon_spacing.php 3 0
26+
tests/input/spread-operator.php 6 0
2627
tests/input/static-closures.php 1 0
2728
tests/input/test-case.php 8 0
2829
tests/input/trailing_comma_on_array.php 1 0
@@ -31,9 +32,9 @@ tests/input/UnusedVariables.php 1 0
3132
tests/input/useless-semicolon.php 2 0
3233
tests/input/UselessConditions.php 20 0
3334
----------------------------------------------------------------------
34-
A TOTAL OF 238 ERRORS AND 0 WARNINGS WERE FOUND IN 27 FILES
35+
A TOTAL OF 244 ERRORS AND 0 WARNINGS WERE FOUND IN 28 FILES
3536
----------------------------------------------------------------------
36-
PHPCBF CAN FIX 202 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
37+
PHPCBF CAN FIX 208 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
3738
----------------------------------------------------------------------
3839

3940

tests/fixed/spread-operator.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
static function (...$x) : void {
6+
}
7+
static function (int ...$x) : void {
8+
}
9+
static function ($x, ...$y) : void {
10+
}
11+
static function (int $x, int ...$y) : void {
12+
}
13+
14+
foo(...$x);
15+
foo($x, ...$y);

tests/input/spread-operator.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
static function (... $x) : void {
6+
}
7+
static function (int ... $x) : void {
8+
}
9+
static function ($x, ... $y) : void {
10+
}
11+
static function (int $x, int ... $y) : void {
12+
}
13+
14+
foo(... $x);
15+
foo($x, ... $y);

0 commit comments

Comments
 (0)