diff --git a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/AbstractClassnameChecker.php b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/AbstractClassnameChecker.php index 218ccee..a01da60 100644 --- a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/AbstractClassnameChecker.php +++ b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/AbstractClassnameChecker.php @@ -43,6 +43,11 @@ abstract class AbstractClassnameChecker implements PhpCsSniff */ public $legacyExtensions = ['Extbase', 'Fluid']; + /** + * @var Mapping + */ + protected $legacyMapping; + public function __construct() { $this->legacyMapping = Mapping::getInstance(); @@ -205,6 +210,7 @@ abstract class AbstractClassnameChecker implements PhpCsSniff * @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 = false) { diff --git a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/Mapping.php b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/Mapping.php index e704584..c7c455e 100644 --- a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/Mapping.php +++ b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/Mapping.php @@ -50,9 +50,7 @@ class Mapping } private function __construct() { - $mappingFile = $this->getMappingFile(); - - $this->mappings = require $mappingFile; + $this->mappings = require $this->getMappingFile(); } // Singleton implementation - End @@ -112,10 +110,8 @@ class Mapping return; } - $mappingFile = $this->getMappingFile(); - file_put_contents( - $mappingFile, + $this->getMappingFile(), 'mappings, true) . ';' ); } diff --git a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff.php b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff.php index 5374dd3..3e3acac 100644 --- a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff.php +++ b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff.php @@ -92,6 +92,7 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract * @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) { @@ -138,9 +139,9 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract } /** - * Returns namespace, without vendor, based on legacy class name. + * Returns namespace, based on legacy class name. * - * E.g. Tx_ExtName_FolderName_FileName -> ExtName\FolderName + * E.g. Tx_ExtName_FolderName_FileName -> VENDOR\ExtName\FolderName * * @param string $classname * @return string diff --git a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff.php b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff.php index 072bf62..4c76a90 100644 --- a/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff.php +++ b/src/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff.php @@ -84,7 +84,7 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingVendorForPluginsAndModulesSniff if ($fix === true) { $phpcsFile->fixer->replaceToken( $firstArgument, - "'{$this->getVendor()}.' . " . $tokens[$firstArgument]['content'] + "'{$this->getVendor()}.' . {$tokens[$firstArgument]['content']}" ); } }