TASK: Fix quality issues
This commit is contained in:
parent
6a115bd8d0
commit
842a54d5d9
4 changed files with 23 additions and 8 deletions
|
@ -212,8 +212,12 @@ abstract class AbstractClassnameChecker implements PhpCsSniff
|
|||
* @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)
|
||||
{
|
||||
protected function replaceLegacyClassname(
|
||||
PhpCsFile $phpcsFile,
|
||||
$classnamePosition,
|
||||
$classname,
|
||||
$forceEmptyPrefix = false
|
||||
) {
|
||||
$prefix = '\\';
|
||||
if ($forceEmptyPrefix || $phpcsFile->getTokens()[$classnamePosition -1]['code'] === T_NS_SEPARATOR) {
|
||||
$prefix = '';
|
||||
|
|
|
@ -60,7 +60,8 @@ class Typo3Update_Sniffs_LegacyClassnames_InlineCommentSniff extends AbstractCla
|
|||
$this->originalTokenContent = $tokens[$stackPtr]['content'];
|
||||
$commentParts = preg_split('/\s+/', $this->originalTokenContent);
|
||||
|
||||
if (count($commentParts) !== 5 || $commentParts[1] !== '@var' || ($commentParts[2][0] !== '$' && $commentParts[3][0] !== '$')) {
|
||||
if (count($commentParts) !== 5 || $commentParts[1] !== '@var'
|
||||
|| ($commentParts[2][0] !== '$' && $commentParts[3][0] !== '$')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,17 @@ use Typo3Update\Sniffs\OptionsAccessTrait;
|
|||
* Will check the configured file for whether a class is legacy and provides further methods.
|
||||
* Also can update to add new migrated class names.
|
||||
*/
|
||||
class Mapping
|
||||
final class Mapping
|
||||
{
|
||||
use OptionsAccessTrait;
|
||||
|
||||
// Singleton implementation - Start
|
||||
static protected $instance = null;
|
||||
/**
|
||||
* Get the singleton instance.
|
||||
*
|
||||
* @return Mapping
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (static::$instance === null) {
|
||||
|
|
|
@ -59,11 +59,12 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract
|
|||
return;
|
||||
}
|
||||
$classnamePosition = $phpcsFile->findNext(T_STRING, $stackPtr);
|
||||
|
||||
if ($classnamePosition === false) {
|
||||
return;
|
||||
}
|
||||
$classname = $tokens[$classnamePosition]['content'];
|
||||
|
||||
$classname = $tokens[$classnamePosition]['content'];
|
||||
$this->addFixableError($phpcsFile, $classnamePosition, $classname);
|
||||
}
|
||||
|
||||
|
@ -94,8 +95,12 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract
|
|||
* @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)
|
||||
{
|
||||
protected function replaceLegacyClassname(
|
||||
PhpCsFile $phpcsFile,
|
||||
$classnamePosition,
|
||||
$classname,
|
||||
$forceEmptyPrefix = true
|
||||
) {
|
||||
parent::replaceLegacyClassname($phpcsFile, $classnamePosition, $classname, $forceEmptyPrefix);
|
||||
|
||||
$tokens = $phpcsFile->getTokens();
|
||||
|
@ -118,7 +123,7 @@ class Typo3Update_Sniffs_LegacyClassnames_MissingNamespaceSniff extends Abstract
|
|||
|
||||
/**
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @return int
|
||||
* @return int|false
|
||||
*/
|
||||
protected function getNamespacePosition(PhpCsFile $phpcsFile)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue