FEATURE: Make sure namespaces are only applied for Tx_ class definitions

* E.g. prevent migration for ux_ classes which do not follow the
  convention.
* Add test to make sure it works as expected.
This commit is contained in:
Daniel Siepmann 2017-05-11 08:59:37 +02:00
parent 40be6732af
commit 53d727fa4b
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
5 changed files with 46 additions and 3 deletions

View file

@ -67,6 +67,9 @@ class Typo3Update_Sniffs_LegacyClassname_MissingNamespaceSniff implements PhpCsS
}
$classname = $tokens[$classnamePosition]['content'];
if (substr($classname, 0, 3) !== 'Tx_') {
return;
}
LegacyClassnameMapping::getInstance()->addLegacyClassname(
$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
namespace Vendor\ExtName\Controller;
/*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
*
@ -23,6 +21,6 @@ namespace Vendor\ExtName\Controller;
use Tx_Extbase_Mvc_Controller_ActionController;
class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
class ux_t3lib_DB extends t3lib_DB
{
}