Skip to content

Commit

Permalink
LowercaseStaticReferenceFixer - Fix \"Parent\" word in namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and SpacePossum committed Jul 30, 2018
1 parent 1c9553a commit b1fcf6c
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 b1fcf6c

Please sign in to comment.