Skip to content

Commit de340e8

Browse files
committed
Merge branch '2.14'
2 parents 1b0cccf + 3b85dfd commit de340e8

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

src/Fixer/Operator/IncrementStyleFixer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ private function findEnd(Tokens $tokens, $index)
137137
[CT::T_DYNAMIC_PROP_BRACE_OPEN],
138138
[CT::T_DYNAMIC_VAR_BRACE_OPEN],
139139
[T_NS_SEPARATOR],
140+
[T_STATIC],
140141
[T_STRING],
141142
[T_VARIABLE],
142143
])) {
@@ -194,11 +195,11 @@ private function findStart(Tokens $tokens, $index)
194195

195196
if ($prevToken->isGivenKind(T_PAAMAYIM_NEKUDOTAYIM)) {
196197
$prevPrevIndex = $tokens->getPrevMeaningfulToken($prevIndex);
197-
if (!$tokens[$prevPrevIndex]->isGivenKind(T_STRING)) {
198+
if (!$tokens[$prevPrevIndex]->isGivenKind([T_STATIC, T_STRING])) {
198199
return $this->findStart($tokens, $prevIndex);
199200
}
200201

201-
$index = $tokens->getTokenNotOfKindSibling($prevIndex, -1, [[T_NS_SEPARATOR], [T_STRING]]);
202+
$index = $tokens->getTokenNotOfKindSibling($prevIndex, -1, [[T_NS_SEPARATOR], [T_STATIC], [T_STRING]]);
202203
$index = $tokens->getNextMeaningfulToken($index);
203204
}
204205

tests/Fixer/FunctionNotation/MethodArgumentSpaceFixerTest.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ final class MethodArgumentSpaceFixerTest extends AbstractFixerTestCase
3434
*/
3535
public function testFix($expected, $input = null, array $configuration = null)
3636
{
37-
if (null !== $configuration) {
38-
$this->fixer->configure($configuration);
39-
}
4037
$indent = ' ';
4138
$lineEnding = "\n";
42-
if (null !== $input) {
43-
if (false !== strpos($input, "\t")) {
39+
40+
if (null !== $expected) {
41+
if (false !== strpos($expected, "\t")) {
4442
$indent = "\t";
45-
} elseif (preg_match('/\n \S/', $input)) {
43+
} elseif (preg_match('/\n \S/', $expected)) {
4644
$indent = ' ';
4745
}
48-
if (false !== strpos($input, "\r")) {
46+
47+
if (false !== strpos($expected, "\r")) {
4948
$lineEnding = "\r\n";
5049
}
5150
}
51+
52+
if (null !== $configuration) {
53+
$this->fixer->configure($configuration);
54+
}
55+
5256
$this->fixer->setWhitespacesConfig(new WhitespacesFixerConfig(
5357
$indent,
5458
$lineEnding

tests/Fixer/Operator/IncrementStyleFixerTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,36 @@ public function provideFixPreIncrementCases()
138138
['<?php foo($a, ++$b);'],
139139
['<?php $a[++$b];'],
140140
['<?php echo ++$a;'],
141+
142+
[
143+
'<?php class Test {
144+
public function foo() {
145+
$a = 123;
146+
++self::$st;
147+
}
148+
}',
149+
'<?php class Test {
150+
public function foo() {
151+
$a = 123;
152+
self::$st++;
153+
}
154+
}',
155+
],
156+
157+
[
158+
'<?php class Test {
159+
public function foo() {
160+
$a = 123;
161+
++static::$st;
162+
}
163+
}',
164+
'<?php class Test {
165+
public function foo() {
166+
$a = 123;
167+
static::$st++;
168+
}
169+
}',
170+
],
141171
];
142172
}
143173
}

0 commit comments

Comments
 (0)