FEATURE: Already save classname alias while searching

* To improve report results even during searching.
* By moving namespace mapping to search from fixing.
This commit is contained in:
Daniel Siepmann 2017-05-11 08:58:35 +02:00
parent 413d8e45f5
commit 40be6732af
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -67,6 +67,11 @@ class Typo3Update_Sniffs_LegacyClassname_MissingNamespaceSniff implements PhpCsS
} }
$classname = $tokens[$classnamePosition]['content']; $classname = $tokens[$classnamePosition]['content'];
LegacyClassnameMapping::getInstance()->addLegacyClassname(
$classname,
$this->getNamespace($classname) . '\\' . $this->getNewClassname($classname)
);
$fix = $phpcsFile->addFixableError( $fix = $phpcsFile->addFixableError(
'Legacy class definitions are not allowed; found "%s".' 'Legacy class definitions are not allowed; found "%s".'
. ' Wrap your class inside a namespace.', . ' Wrap your class inside a namespace.',
@ -106,10 +111,6 @@ class Typo3Update_Sniffs_LegacyClassname_MissingNamespaceSniff implements PhpCsS
$this->getNamespacePosition($phpcsFile), $this->getNamespacePosition($phpcsFile),
'<?php' . $lineEndings . $this->getNamespaceDefinition($classname) . $suffix '<?php' . $lineEndings . $this->getNamespaceDefinition($classname) . $suffix
); );
LegacyClassnameMapping::getInstance()->addLegacyClassname(
$classname,
$this->getNamespace($classname) . '\\' . $this->getNewClassname($classname)
);
} }
/** /**