Merge branch 'feature/improve-namespaces' into 'develop'

FEATURE: Improve namespace migration

See merge request !91
This commit is contained in:
Daniel Hürtgen 2017-05-16 14:42:46 +02:00
commit 8d93512b20
5 changed files with 51 additions and 7 deletions

View file

@ -67,6 +67,14 @@ class Typo3Update_Sniffs_LegacyClassname_MissingNamespaceSniff implements PhpCsS
} }
$classname = $tokens[$classnamePosition]['content']; $classname = $tokens[$classnamePosition]['content'];
if (substr($classname, 0, 3) !== 'Tx_') {
return;
}
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 +114,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)
);
} }
/** /**

View file

@ -0,0 +1,14 @@
{
"files": {
"InputFileForIssues.php": {
"errors": 0,
"messages": [],
"warnings": 0
}
},
"totals": {
"errors": 0,
"fixable": 0,
"warnings": 0
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace Vendor\ExtName\Controller;
/*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Tx_Extbase_Mvc_Controller_ActionController;
class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
{
}

View file

@ -1,7 +1,5 @@
<?php <?php
namespace Vendor\ExtName\Controller;
/* /*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
* *
@ -23,6 +21,6 @@ namespace Vendor\ExtName\Controller;
use Tx_Extbase_Mvc_Controller_ActionController; use Tx_Extbase_Mvc_Controller_ActionController;
class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController class ux_t3lib_DB extends t3lib_DB
{ {
} }