diff --git a/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php b/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php index 2b0ba34a4a6..ddf57404cae 100644 --- a/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php +++ b/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php @@ -152,6 +152,11 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens) break; } + $prevIndex = $tokens->getPrevMeaningfulToken($currIndex); + if ($tokens[$prevIndex]->isGivenKind(T_CONST)) { + continue; + } + $originalClass = $tokens[$currIndex]->getContent(); if (1 !== Preg::match($this->originalClassRegEx, $originalClass)) { diff --git a/tests/Fixer/PhpUnit/PhpUnitNamespacedFixerTest.php b/tests/Fixer/PhpUnit/PhpUnitNamespacedFixerTest.php index fdc8e235ef4..057067e3b74 100644 --- a/tests/Fixer/PhpUnit/PhpUnitNamespacedFixerTest.php +++ b/tests/Fixer/PhpUnit/PhpUnitNamespacedFixerTest.php @@ -235,6 +235,13 @@ public function aaa() echo \PHPUnit_Runner_Version::id(); ', ], + [ + '