Skip to content

Commit 80b4b4e

Browse files
committed
Merge branch 'feature/3618-generic-arbitrary-parentheses-bugfix' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 8d65f45 + 760990b commit 80b4b4e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,15 @@ $a = (
163163
if (true) {} ( 1+2) === 3 ? $a = 1 : $a = 2;
164164
class A {} ( 1+2) === 3 ? $a = 1 : $a = 2;
165165
function foo() {} ( 1+2) === 3 ? $a = 1 : $a = 2;
166+
167+
// Issue #3618.
168+
class NonArbitraryParenthesesWithKeywords {
169+
public static function baz( $foo, $bar ) {
170+
$a = new self();
171+
$b = new parent();
172+
$c = new static();
173+
174+
// self/static are already tested above, round line 45.
175+
$d = new parent( $foo,$bar );
176+
}
177+
}

src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ $a = (
151151
if (true) {} (1+2) === 3 ? $a = 1 : $a = 2;
152152
class A {} (1+2) === 3 ? $a = 1 : $a = 2;
153153
function foo() {} (1+2) === 3 ? $a = 1 : $a = 2;
154+
155+
// Issue #3618.
156+
class NonArbitraryParenthesesWithKeywords {
157+
public static function baz( $foo, $bar ) {
158+
$a = new self();
159+
$b = new parent();
160+
$c = new static();
161+
162+
// self/static are already tested above, round line 45.
163+
$d = new parent( $foo,$bar );
164+
}
165+
}

src/Util/Tokens.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ final class Tokens
628628
T_UNSET => T_UNSET,
629629
T_EMPTY => T_EMPTY,
630630
T_SELF => T_SELF,
631+
T_PARENT => T_PARENT,
631632
T_STATIC => T_STATIC,
632633
];
633634

0 commit comments

Comments
 (0)