FEATURE: Migrate legacy class names in use statements

Resolves: #49
This commit is contained in:
Daniel Siepmann 2017-04-04 14:39:31 +02:00
parent 2d33832a79
commit 2e115bb3f7
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -19,10 +19,13 @@
* 02110-1301, USA.
*/
use PHP_CodeSniffer_File as PhpCsFile;
use Typo3Update\Sniffs\LegacyClassnames\AbstractClassnameChecker;
/**
* Migrate old legacy class names in use statements.
* Detect and migrate use statements with legacy classnames..
*
* According to PSR-2, only one class per use statement is expected.
*/
class Typo3Update_Sniffs_LegacyClassnames_UseSniff extends AbstractClassnameChecker
{
@ -35,4 +38,21 @@ class Typo3Update_Sniffs_LegacyClassnames_UseSniff extends AbstractClassnameChec
{
return [T_USE];
}
/**
* Overwrite to remove prefix.
*
* @param PhpCsFile $phpcsFile
* @param int $classnamePosition
* @param string $classname
* @param bool $forceEmptyPrefix Defines whether '\\' prefix should be checked or always be left out.
*/
protected function replaceLegacyClassname(
PhpCsFile $phpcsFile,
$classnamePosition,
$classname,
$forceEmptyPrefix = true
) {
return parent::replaceLegacyClassname($phpcsFile, $classnamePosition, $classname, $forceEmptyPrefix);
}
}