Skip to content

Commit

Permalink
bug #3937 LowercaseStaticReferenceFixer - Fix "Parent" word in namesp…
Browse files Browse the repository at this point in the history
…ace (kubawerlos)

This PR was squashed before being merged into the 2.12 branch (closes #3937).

Discussion
----------

LowercaseStaticReferenceFixer - Fix "Parent" word in namespace

Commits
-------

b1fcf6c LowercaseStaticReferenceFixer - Fix \"Parent\" word in namespace
  • Loading branch information
SpacePossum committed Jul 30, 2018
2 parents 1c9553a + b1fcf6c commit 41f3cba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer/Casing/LowercaseStaticReferenceFixer.php
Expand Up @@ -86,7 +86,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
}

$prevIndex = $tokens->getPrevMeaningfulToken($index);
if ($tokens[$prevIndex]->isGivenKind([T_CONST, T_DOUBLE_COLON, T_FUNCTION, T_OBJECT_OPERATOR, T_PRIVATE, T_PROTECTED, T_PUBLIC])) {
if ($tokens[$prevIndex]->isGivenKind([T_CONST, T_DOUBLE_COLON, T_FUNCTION, T_NAMESPACE, T_NS_SEPARATOR, T_OBJECT_OPERATOR, T_PRIVATE, T_PROTECTED, T_PUBLIC])) {
continue;
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Fixer/Casing/LowercaseStaticReferenceFixerTest.php
Expand Up @@ -137,6 +137,12 @@ public function provideFixCases()
[
'<?php class A { const PARENT = 42; }',
],
[
'<?php namespace Foo\Parent;',
],
[
'<?php namespace Parent\Foo;',
],
];
}

Expand Down Expand Up @@ -169,6 +175,9 @@ public function provideFix70Cases()
[
'<?php class Foo extends Bar { public function baz() : Self\Qux {} }',
],
[
'<?php namespace Parent;',
],
];
}

Expand Down

0 comments on commit 41f3cba

Please sign in to comment.