Skip to content

Commit 13921de

Browse files
committed
Generic/FunctionCallArgumentSpacing: fix regression for new parent
Related to 3546 which fixed an inconsistency after 3484. The change of the tokenization from `T_STRING` to `T_PARENT` for the `parent` keyword in `new parent` caused a regression in the `Generic.Functions.FunctionCallArgumentSpacing` sniff. Fixed now. Includes unit tests.
1 parent 9445108 commit 13921de

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function register()
3030
T_UNSET,
3131
T_SELF,
3232
T_STATIC,
33+
T_PARENT,
3334
T_VARIABLE,
3435
T_CLOSE_CURLY_BRACKET,
3536
T_CLOSE_PARENTHESIS,

src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,12 @@ $foobar = functionCallAnonClassParam(
153153
$result = myFunction(param1: $arg1, param2: $arg2);
154154
$result = myFunction(param1: $arg1 , param2:$arg2);
155155
$result = myFunction(param1: $arg1, param2:$arg2, param3: $arg3,param4:$arg4, param5:$arg5);
156+
157+
class Testing extends Bar
158+
{
159+
public static function baz($foo, $bar)
160+
{
161+
$a = new parent($foo, $bar);
162+
$a = new parent($foo ,$bar);
163+
}
164+
}

src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc.fixed

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,12 @@ $foobar = functionCallAnonClassParam(
153153
$result = myFunction(param1: $arg1, param2: $arg2);
154154
$result = myFunction(param1: $arg1, param2:$arg2);
155155
$result = myFunction(param1: $arg1, param2:$arg2, param3: $arg3, param4:$arg4, param5:$arg5);
156+
157+
class Testing extends Bar
158+
{
159+
public static function baz($foo, $bar)
160+
{
161+
$a = new parent($foo, $bar);
162+
$a = new parent($foo, $bar);
163+
}
164+
}

src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function getErrorList()
5454
134 => 1,
5555
154 => 2,
5656
155 => 1,
57+
162 => 2,
5758
];
5859

5960
}//end getErrorList()

0 commit comments

Comments
 (0)