Merge pull request #56 from DanielSiepmann/feature/46-automated-testing
Feature/46 automated testing
This commit is contained in:
commit
38722b7d51
67 changed files with 6777 additions and 10 deletions
13
.scrutinizer.yml
Normal file
13
.scrutinizer.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
build:
|
||||||
|
tests:
|
||||||
|
before:
|
||||||
|
- make install
|
||||||
|
environment:
|
||||||
|
php:
|
||||||
|
version: 5.6
|
||||||
|
ini:
|
||||||
|
'date.timezone': 'Europe/Berlin'
|
||||||
|
|
||||||
|
filter:
|
||||||
|
excluded_paths:
|
||||||
|
- "tests/Fixtures/"
|
|
@ -2,6 +2,11 @@
|
||||||
"name": "siepmann/typo3_update",
|
"name": "siepmann/typo3_update",
|
||||||
"description": "Auto migrate PHP Source of extensions to be compatible.",
|
"description": "Auto migrate PHP Source of extensions to be compatible.",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Typo3Update\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Typo3Update\\": "src/Standards/Typo3Update/"
|
"Typo3Update\\": "src/Standards/Typo3Update/"
|
||||||
|
@ -27,5 +32,9 @@
|
||||||
"name": "Daniel Siepmann",
|
"name": "Daniel Siepmann",
|
||||||
"email": "coding@daniel-siepmann.de"
|
"email": "coding@daniel-siepmann.de"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^5.7",
|
||||||
|
"symfony/finder": "^3.2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
27
phpunit.xml.dist
Normal file
27
phpunit.xml.dist
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit backupGlobals="false"
|
||||||
|
backupStaticAttributes="false"
|
||||||
|
colors="true"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnError="false"
|
||||||
|
stopOnFailure="false"
|
||||||
|
stopOnIncomplete="false"
|
||||||
|
stopOnSkipped="false"
|
||||||
|
stopOnRisky="false"
|
||||||
|
syntaxCheck="false">
|
||||||
|
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Project Test Suite">
|
||||||
|
<directory>./tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory>./src/</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
|
@ -231,7 +231,7 @@ abstract class AbstractClassnameChecker implements PhpCsSniff
|
||||||
|
|
||||||
$phpcsFile->fixer->replaceToken(
|
$phpcsFile->fixer->replaceToken(
|
||||||
$classnamePosition,
|
$classnamePosition,
|
||||||
$this->getTokenForReplacement($prefix . $this->getNewClassname($classname), $classname)
|
$this->getTokenForReplacement($prefix . $this->getNewClassname($classname), $classname, $phpcsFile)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,9 +241,10 @@ abstract class AbstractClassnameChecker implements PhpCsSniff
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
return $newClassname;
|
return $newClassname;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,10 @@ class Typo3Update_Sniffs_LegacyClassnames_DocCommentSniff extends AbstractClassn
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
$token = explode(' ', $this->originalTokenContent);
|
$token = explode(' ', $this->originalTokenContent);
|
||||||
|
|
||||||
|
|
|
@ -83,13 +83,19 @@ class Typo3Update_Sniffs_LegacyClassnames_InlineCommentSniff extends AbstractCla
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
$token = preg_split('/\s+/', $this->originalTokenContent);
|
$token = preg_split('/\s+/', $this->originalTokenContent);
|
||||||
$token[$this->getClassnamePosition($token)] = $newClassname;
|
$token[$this->getClassnamePosition($token)] = $newClassname;
|
||||||
|
|
||||||
|
// Keep line ending, removed by preg_split
|
||||||
|
if ($token[0] === '//') {
|
||||||
|
$token[count($token)] = $phpcsFile->eolChar;
|
||||||
|
}
|
||||||
|
|
||||||
return implode(' ', $token);
|
return implode(' ', $token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,10 @@ class Typo3Update_Sniffs_LegacyClassnames_InstantiationWithMakeInstanceSniff ext
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
return $this->getTokenReplacementForString($newClassname);
|
return $this->getTokenReplacementForString($newClassname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,11 @@ class Typo3Update_Sniffs_LegacyClassnames_InstantiationWithObjectManagerSniff ex
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr);
|
$classnamePosition = $phpcsFile->findNext(
|
||||||
|
T_CONSTANT_ENCAPSED_STRING,
|
||||||
|
$stackPtr,
|
||||||
|
$phpcsFile->findNext(T_CLOSE_PARENTHESIS, $stackPtr)
|
||||||
|
);
|
||||||
if ($classnamePosition === false) {
|
if ($classnamePosition === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,9 +89,10 @@ class Typo3Update_Sniffs_LegacyClassnames_InstantiationWithObjectManagerSniff ex
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
return $this->getTokenReplacementForString($newClassname);
|
return $this->getTokenReplacementForString($newClassname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,11 @@ class Typo3Update_Sniffs_LegacyClassnames_IsACallSniff extends AbstractClassname
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $phpcsFile->findNext(T_COMMA, $stackPtr));
|
$classnamePosition = $phpcsFile->findNext(
|
||||||
|
T_CONSTANT_ENCAPSED_STRING,
|
||||||
|
$phpcsFile->findNext(T_COMMA, $stackPtr),
|
||||||
|
$phpcsFile->findNext(T_CLOSE_PARENTHESIS, $stackPtr)
|
||||||
|
);
|
||||||
if ($classnamePosition === false) {
|
if ($classnamePosition === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -74,9 +78,10 @@ class Typo3Update_Sniffs_LegacyClassnames_IsACallSniff extends AbstractClassname
|
||||||
*
|
*
|
||||||
* @param string $newClassname
|
* @param string $newClassname
|
||||||
* @param string $originalClassname
|
* @param string $originalClassname
|
||||||
|
* @param PhpCsFile $phpcsFile
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getTokenForReplacement($newClassname, $originalClassname)
|
protected function getTokenForReplacement($newClassname, $originalClassname, PhpCsFile $phpcsFile)
|
||||||
{
|
{
|
||||||
return $this->getTokenReplacementForString($newClassname);
|
return $this->getTokenReplacementForString($newClassname);
|
||||||
}
|
}
|
||||||
|
|
26
tests/FileNotFoundException.php
Normal file
26
tests/FileNotFoundException.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Typo3Update\Tests;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class FileNotFoundException extends \Exception
|
||||||
|
{
|
||||||
|
}
|
4304
tests/Fixtures/LegacyClassnames.php
Normal file
4304
tests/Fixtures/LegacyClassnames.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ext_tables' => [
|
||||||
|
'inputFileName' => 'ext_tables.php',
|
||||||
|
],
|
||||||
|
'ext_localconf' => [
|
||||||
|
'inputFileName' => 'ext_localconf.php',
|
||||||
|
],
|
||||||
|
];
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"ext_localconf.php": {
|
||||||
|
"errors": 0,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 54,
|
||||||
|
"fixable": false,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Defining AJAX using $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] is no longer supported with a single String like 'something'. Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests. See: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.Deprecated.AjaxRegistration",
|
||||||
|
"type": "WARNING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 54,
|
||||||
|
"fixable": false,
|
||||||
|
"line": 23,
|
||||||
|
"message": "Defining AJAX using $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] is no longer supported with a single String like \"something\". Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests. See: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.Deprecated.AjaxRegistration",
|
||||||
|
"type": "WARNING"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 0,
|
||||||
|
"fixable": 0,
|
||||||
|
"warnings": 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] = 'something';
|
||||||
|
$GLOBALS["TYPO3_CONF_VARS"]["BE"]["AJAX"][$ajaxID] = "something";
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"ext_tables.php": {
|
||||||
|
"errors": 0,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 54,
|
||||||
|
"fixable": false,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Defining AJAX using $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] is no longer supported with a single String like 'something'. Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests. See: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.Deprecated.AjaxRegistration",
|
||||||
|
"type": "WARNING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 54,
|
||||||
|
"fixable": false,
|
||||||
|
"line": 23,
|
||||||
|
"message": "Defining AJAX using $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] is no longer supported with a single String like \"something\". Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests. See: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.Deprecated.AjaxRegistration",
|
||||||
|
"type": "WARNING"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 0,
|
||||||
|
"fixable": 0,
|
||||||
|
"warnings": 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxID] = 'something';
|
||||||
|
$GLOBALS["TYPO3_CONF_VARS"]["BE"]["AJAX"][$ajaxID] = "something";
|
|
@ -0,0 +1,26 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/DocCommentSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -22,19 +22,19 @@
|
||||||
|
class InputFileForIssues
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
- * @var Tx_Extbase_Domain_Repository_CategoryRepository
|
||||||
|
+ * @var \TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository
|
||||||
|
* @inject
|
||||||
|
*/
|
||||||
|
protected $someVar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
- * @param t3lib_div
|
||||||
|
+ * @param \TYPO3\CMS\Core\Utility\GeneralUtility
|
||||||
|
*
|
||||||
|
- * @return Tx_Extbase_Configuration_Configurationmanager
|
||||||
|
+ * @return \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
|
||||||
|
*/
|
||||||
|
public function doSomething($something)
|
||||||
|
{
|
||||||
|
- /** @var t3lib_div $variable */ // This is supported as this is a phpdoc.
|
||||||
|
+ /** @var \TYPO3\CMS\Core\Utility\GeneralUtility $variable */ // This is supported as this is a phpdoc.
|
||||||
|
/** @var $variable t3lib_div */ // This is not supported! Use inline comments instead.
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 4,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 13,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 25,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Repository_CategoryRepository\", use \"TYPO3\\CMS\\Extbase\\Domain\\Repository\\CategoryRepository\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 15,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 16,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 33,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 18,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 37,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.DocComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 4,
|
||||||
|
"fixable": 4,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InputFileForIssues
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Tx_Extbase_Domain_Repository_CategoryRepository
|
||||||
|
* @inject
|
||||||
|
*/
|
||||||
|
protected $someVar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param t3lib_div
|
||||||
|
*
|
||||||
|
* @return Tx_Extbase_Configuration_Configurationmanager
|
||||||
|
*/
|
||||||
|
public function doSomething($something)
|
||||||
|
{
|
||||||
|
/** @var t3lib_div $variable */ // This is supported as this is a phpdoc.
|
||||||
|
/** @var $variable t3lib_div */ // This is not supported! Use inline comments instead.
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InheritanceSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,14 +19,14 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements t3lib_Singleton, Tx_Extbase_Core_BootstrapInterface
|
||||||
|
+class InputFileForIssues extends \TYPO3\CMS\Extbase\Configuration\ConfigurationManager implements \TYPO3\CMS\Core\SingletonInterface, \TYPO3\CMS\Extbase\Core\BootstrapInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements
|
||||||
|
- t3lib_Singleton,
|
||||||
|
- Tx_Extbase_Core_BootstrapInterface
|
||||||
|
+class InputFileForIssues extends \TYPO3\CMS\Extbase\Configuration\ConfigurationManager implements
|
||||||
|
+ \TYPO3\CMS\Core\SingletonInterface,
|
||||||
|
+ \TYPO3\CMS\Extbase\Core\BootstrapInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 34,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 91,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 108,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Core_BootstrapInterface\", use \"TYPO3\\CMS\\Extbase\\Core\\BootstrapInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 34,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 27,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 28,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 29,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Core_BootstrapInterface\", use \"TYPO3\\CMS\\Extbase\\Core\\BootstrapInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Inheritance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements t3lib_Singleton, Tx_Extbase_Core_BootstrapInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager implements
|
||||||
|
t3lib_Singleton,
|
||||||
|
Tx_Extbase_Core_BootstrapInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InlineCommentSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -23,16 +23,16 @@
|
||||||
|
{
|
||||||
|
public function something()
|
||||||
|
{
|
||||||
|
- /* @var $variable Tx_Extbase_Command_HelpCommandController */
|
||||||
|
+ /* @var $variable \TYPO3\CMS\Extbase\Command\HelpCommandController */
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
- // @var $variable Tx_Extbase_Command_HelpCommandController
|
||||||
|
+ // @var $variable \TYPO3\CMS\Extbase\Command\HelpCommandController
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
- /* @var Tx_Extbase_Command_HelpCommandController $variable */
|
||||||
|
+ /* @var \TYPO3\CMS\Extbase\Command\HelpCommandController $variable */
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
- // @var Tx_Extbase_Command_HelpCommandController $variable
|
||||||
|
+ // @var \TYPO3\CMS\Extbase\Command\HelpCommandController $variable
|
||||||
|
$variable;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 4,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 9,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 26,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 9,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 29,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 9,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 32,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 9,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 35,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InlineComment.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 4,
|
||||||
|
"fixable": 4,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InputFileForIssues
|
||||||
|
{
|
||||||
|
public function something()
|
||||||
|
{
|
||||||
|
/* @var $variable Tx_Extbase_Command_HelpCommandController */
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
// @var $variable Tx_Extbase_Command_HelpCommandController
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
/* @var Tx_Extbase_Command_HelpCommandController $variable */
|
||||||
|
$variable;
|
||||||
|
|
||||||
|
// @var Tx_Extbase_Command_HelpCommandController $variable
|
||||||
|
$variable;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InstanceofSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,6 +19,6 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-if ($a instanceof t3lib_Singleton) {
|
||||||
|
+if ($a instanceof \TYPO3\CMS\Core\SingletonInterface) {
|
||||||
|
// do something
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 1,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 19,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Instanceof.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 1,
|
||||||
|
"fixable": 1,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($a instanceof t3lib_Singleton) {
|
||||||
|
// do something
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InstantiationWithMakeInstanceSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,6 +19,6 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-t3lib_div::makeInstance('Tx_Extbase_Command_HelpCommandController');
|
||||||
|
+t3lib_div::makeInstance('\TYPO3\CMS\Extbase\Command\HelpCommandController');
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 1,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 25,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithMakeInstance.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 1,
|
||||||
|
"fixable": 1,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
t3lib_div::makeInstance('Tx_Extbase_Command_HelpCommandController');
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
|
|
@ -0,0 +1,22 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InstantiationWithNewSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,13 +19,13 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-new \Tx_Extbase_Command_HelpCommandController();
|
||||||
|
-new \Tx_Extbase_Command_HelpCommandController;
|
||||||
|
-(new \Tx_Extbase_Command_HelpCommandController)
|
||||||
|
+new \TYPO3\CMS\Extbase\Command\HelpCommandController();
|
||||||
|
+new \TYPO3\CMS\Extbase\Command\HelpCommandController;
|
||||||
|
+(new \TYPO3\CMS\Extbase\Command\HelpCommandController)
|
||||||
|
->doSomething()
|
||||||
|
;
|
||||||
|
-new Tx_Extbase_Command_HelpCommandController();
|
||||||
|
-new Tx_Extbase_Command_HelpCommandController;
|
||||||
|
-(new Tx_Extbase_Command_HelpCommandController)
|
||||||
|
+new \TYPO3\CMS\Extbase\Command\HelpCommandController();
|
||||||
|
+new \TYPO3\CMS\Extbase\Command\HelpCommandController;
|
||||||
|
+(new \TYPO3\CMS\Extbase\Command\HelpCommandController)
|
||||||
|
->doSomething()
|
||||||
|
;
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 6,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 6,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 23,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 7,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 24,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 27,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 28,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 6,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 29,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithNew.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
new \Tx_Extbase_Command_HelpCommandController();
|
||||||
|
new \Tx_Extbase_Command_HelpCommandController;
|
||||||
|
(new \Tx_Extbase_Command_HelpCommandController)
|
||||||
|
->doSomething()
|
||||||
|
;
|
||||||
|
new Tx_Extbase_Command_HelpCommandController();
|
||||||
|
new Tx_Extbase_Command_HelpCommandController;
|
||||||
|
(new Tx_Extbase_Command_HelpCommandController)
|
||||||
|
->doSomething()
|
||||||
|
;
|
|
@ -0,0 +1,20 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/InstantiationWithObjectManagerSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -21,13 +21,13 @@
|
||||||
|
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
-$this->objectManager->get('\Tx_Extbase_Command_HelpCommandController');
|
||||||
|
-$this->objectManager->get('Tx_Extbase_Command_HelpCommandController');
|
||||||
|
+$this->objectManager->get('\TYPO3\CMS\Extbase\Command\HelpCommandController');
|
||||||
|
+$this->objectManager->get('\TYPO3\CMS\Extbase\Command\HelpCommandController');
|
||||||
|
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
- ->get('\Tx_Extbase_Command_HelpCommandController');
|
||||||
|
+ ->get('\TYPO3\CMS\Extbase\Command\HelpCommandController');
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
- ->get('Tx_Extbase_Command_HelpCommandController');
|
||||||
|
+ ->get('\TYPO3\CMS\Extbase\Command\HelpCommandController');
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 4,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 27,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 24,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithObjectManager.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 27,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 25,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithObjectManager.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 11,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithObjectManager.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 11,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 33,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.InstantiationWithObjectManager.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 4,
|
||||||
|
"fixable": 4,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
$this->objectManager->get('\Tx_Extbase_Command_HelpCommandController');
|
||||||
|
$this->objectManager->get('Tx_Extbase_Command_HelpCommandController');
|
||||||
|
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||||
|
->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
->get('\Tx_Extbase_Command_HelpCommandController');
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
->get('Tx_Extbase_Command_HelpCommandController');
|
|
@ -0,0 +1,14 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/IsACallSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -23,9 +23,9 @@
|
||||||
|
if (is_a($a, t3lib_Singleton::class)) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
-if (is_a($a, 't3lib_Singleton')) {
|
||||||
|
+if (is_a($a, '\TYPO3\CMS\Core\SingletonInterface')) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
-if (is_a($a, '\t3lib_Singleton')) {
|
||||||
|
+if (is_a($a, '\TYPO3\CMS\Core\SingletonInterface')) {
|
||||||
|
// do something
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 2,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 14,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 26,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.IsACall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 14,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 29,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.IsACall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 2,
|
||||||
|
"fixable": 2,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Handled by static call sniff.
|
||||||
|
if (is_a($a, t3lib_Singleton::class)) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
if (is_a($a, 't3lib_Singleton')) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
if (is_a($a, '\t3lib_Singleton')) {
|
||||||
|
// do something
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'defaultVendor' => [],
|
||||||
|
'customVendor' => [
|
||||||
|
'runtime-set' => [
|
||||||
|
'vendor' => 'MyCustomVendor',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -0,0 +1,16 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff/customVendor/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
<?php
|
||||||
|
+namespace MyCustomVendor\ExtName\Controller;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||||
|
@@ -21,6 +22,6 @@
|
||||||
|
|
||||||
|
use Tx_Extbase_Mvc_Controller_ActionController;
|
||||||
|
|
||||||
|
-class Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
+class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 1,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 7,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 24,
|
||||||
|
"message": "Legacy class definitions are not allowed; found \"Tx_ExtName_Controller_Frontendcontroller\". Wrap your class inside a namespace.",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingNamespace.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 1,
|
||||||
|
"fixable": 1,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingNamespaceSniff/defaultVendor/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
<?php
|
||||||
|
+namespace YourCompany\ExtName\Controller;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||||
|
@@ -21,6 +22,6 @@
|
||||||
|
|
||||||
|
use Tx_Extbase_Mvc_Controller_ActionController;
|
||||||
|
|
||||||
|
-class Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
+class Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 1,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 7,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 24,
|
||||||
|
"message": "Legacy class definitions are not allowed; found \"Tx_ExtName_Controller_Frontendcontroller\". Wrap your class inside a namespace.",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingNamespace.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 1,
|
||||||
|
"fixable": 1,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 Tx_ExtName_Controller_Frontendcontroller extends Tx_Extbase_Mvc_Controller_ActionController
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'defaultVendor' => [],
|
||||||
|
'customVendor' => [
|
||||||
|
'runtime-set' => [
|
||||||
|
'vendor' => 'MyCustomVendor',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -0,0 +1,52 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/customVendor/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
@@ -36,19 +36,19 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
@@ -58,7 +58,7 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'MyCustomVendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 23,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 39,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 45,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 51,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 61,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"MyCustomVendor.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
$_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
$_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Already vendor exists
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
|
@ -0,0 +1,52 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/defaultVendor/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
@@ -36,19 +36,19 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
@@ -58,7 +58,7 @@
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
- $_EXTKEY,
|
||||||
|
+ 'YourCompany.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 23,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 39,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 45,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 51,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 61,
|
||||||
|
"message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
$_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
$_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Already vendor exists
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerPlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'name',
|
||||||
|
'title'
|
||||||
|
);
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::registerModule(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||||
|
'Vendor.' . $_EXTKEY,
|
||||||
|
'subpart',
|
||||||
|
'key'
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
'Controller' => 'action',
|
||||||
|
]
|
||||||
|
);
|
|
@ -0,0 +1,21 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,13 +19,13 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
+\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
['Controller' => 'action']
|
||||||
|
);
|
||||||
|
-t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
-$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
+\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
|
||||||
|
+$this->objectManager->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
- ->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
-is_a($a, t3lib_Singleton::class);
|
||||||
|
+ ->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
|
||||||
|
+is_a($a, \TYPO3\CMS\Core\SingletonInterface::class);
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 1,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Utility_Extension\", use \"TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 1,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 27,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 25,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 27,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 28,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 28,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 12,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 30,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 10,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Tx_Extbase_Utility_Extension::configurePlugin(
|
||||||
|
$_EXTKEY,
|
||||||
|
'name',
|
||||||
|
['Controller' => 'action']
|
||||||
|
);
|
||||||
|
t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager)
|
||||||
|
->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||||
|
is_a($a, t3lib_Singleton::class);
|
|
@ -0,0 +1,18 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -21,13 +21,13 @@
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
-} catch (\Tx_Extbase_Exception $e) {
|
||||||
|
+} catch (\TYPO3\CMS\Extbase\Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
-} catch (Tx_Extbase_Exception $e) {
|
||||||
|
+} catch (\TYPO3\CMS\Extbase\Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 2,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 11,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 24,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 10,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 30,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 2,
|
||||||
|
"fixable": 2,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
} catch (\Tx_Extbase_Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
} catch (Tx_Extbase_Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
} catch (\TYPO3\CMS\Extbase\Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// something
|
||||||
|
} catch (TYPO3\CMS\Extbase\Exception $e) {
|
||||||
|
// else
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -25,10 +25,10 @@
|
||||||
|
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
-function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
-function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -40,10 +40,10 @@
|
||||||
|
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -53,10 +53,10 @@
|
||||||
|
public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- public function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- public function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 6,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 21,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 28,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 20,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 31,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 25,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 43,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 24,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 46,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 32,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 56,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 31,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 59,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 6,
|
||||||
|
"fixable": 6,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class SomeClass
|
||||||
|
{
|
||||||
|
function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public function something(\Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php
|
||||||
|
+++ PHP_CodeSniffer
|
||||||
|
@@ -19,8 +19,8 @@
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-use \Tx_Extbase_Domain_Model_Backenduser;
|
||||||
|
-use Tx_Extbase_Domain_Model_Backenduser;
|
||||||
|
+use \TYPO3\CMS\Extbase\Domain\Model\BackendUser;
|
||||||
|
+use TYPO3\CMS\Extbase\Domain\Model\BackendUser;
|
||||||
|
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||||
|
use \TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"InputFileForIssues.php": {
|
||||||
|
"errors": 2,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"column": 6,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 22,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Use.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": 5,
|
||||||
|
"fixable": true,
|
||||||
|
"line": 23,
|
||||||
|
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead",
|
||||||
|
"severity": 5,
|
||||||
|
"source": "Typo3Update.LegacyClassnames.Use.legacyClassname",
|
||||||
|
"type": "ERROR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"totals": {
|
||||||
|
"errors": 2,
|
||||||
|
"fixable": 2,
|
||||||
|
"warnings": 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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_Domain_Model_Backenduser;
|
||||||
|
use Tx_Extbase_Domain_Model_Backenduser;
|
||||||
|
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||||
|
use \TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||||
|
|
329
tests/SniffsTest.php
Normal file
329
tests/SniffsTest.php
Normal file
|
@ -0,0 +1,329 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Typo3Update\Tests;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will test all sniffs where fixtures are available.
|
||||||
|
*
|
||||||
|
* To add a test, just create the necessary fixture folder structure with files.
|
||||||
|
*/
|
||||||
|
class SniffsTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get all fixtures for sniffs.
|
||||||
|
*
|
||||||
|
* Execute each sniff based on found fixtures and compare result.
|
||||||
|
*
|
||||||
|
* @dataProvider getSniffs
|
||||||
|
* @test
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @param array $arguments
|
||||||
|
*/
|
||||||
|
public function sniffs(\SplFileInfo $folder, array $arguments = [])
|
||||||
|
{
|
||||||
|
if ($arguments !== []) {
|
||||||
|
$this->executeSniffSubfolders($folder, $arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->executeSniff($folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all sniffs to test.
|
||||||
|
* Use e.g. as data provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSniffs()
|
||||||
|
{
|
||||||
|
$sniffs = [];
|
||||||
|
$finder = new Finder();
|
||||||
|
$finder->in(
|
||||||
|
__DIR__
|
||||||
|
. DIRECTORY_SEPARATOR . 'Fixtures'
|
||||||
|
. DIRECTORY_SEPARATOR . 'Standards'
|
||||||
|
. DIRECTORY_SEPARATOR . 'Typo3Update'
|
||||||
|
. DIRECTORY_SEPARATOR . 'Sniffs'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($finder->directories()->name('*Sniff') as $folder) {
|
||||||
|
$sniff = [
|
||||||
|
$folder,
|
||||||
|
[],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (is_file($this->getArgumentsFile($folder))) {
|
||||||
|
$arguments = require $this->getArgumentsFile($folder);
|
||||||
|
$sniff[1] = $arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sniffs[] = $sniff;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sniffs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute sniff using subfolders.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @param array $arguments
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function executeSniffSubfolders(\SplFileInfo $folder, array $arguments = [])
|
||||||
|
{
|
||||||
|
$finder = new Finder();
|
||||||
|
$finder->in($folder->getRealPath());
|
||||||
|
|
||||||
|
foreach ($arguments as $subFolder => $values) {
|
||||||
|
$folderName = $folder->getRealPath() . DIRECTORY_SEPARATOR . $subFolder;
|
||||||
|
$this->executeSniff(new \SplFileInfo($folderName), $values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute phpunit assertion for sniff based on $folder.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @param array $arguments
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function executeSniff(\SplFileInfo $folder, array $arguments = [])
|
||||||
|
{
|
||||||
|
$internalArguments = array_merge_recursive([
|
||||||
|
'runtime-set' => [
|
||||||
|
'mappingFile' => __DIR__ . DIRECTORY_SEPARATOR
|
||||||
|
. 'Fixtures' . DIRECTORY_SEPARATOR
|
||||||
|
. 'LegacyClassnames.php',
|
||||||
|
],
|
||||||
|
'report' => 'json',
|
||||||
|
'sniffs' => $this->getSniffByFolder($folder),
|
||||||
|
'inputFile' => $folder->getRealPath() . DIRECTORY_SEPARATOR . 'InputFileForIssues.php',
|
||||||
|
], $arguments);
|
||||||
|
|
||||||
|
if (isset($internalArguments['inputFileName'])) {
|
||||||
|
$internalArguments['inputFile'] = $folder->getRealPath()
|
||||||
|
. DIRECTORY_SEPARATOR
|
||||||
|
. $internalArguments['inputFileName'];
|
||||||
|
unset($internalArguments['inputFileName']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->getExpectedJsonOutput($folder),
|
||||||
|
$this->getOutput($internalArguments)['output'],
|
||||||
|
'Checking Sniff "' . $this->getSniffByFolder($folder) . '"'
|
||||||
|
. ' did not produce expected output for input file '
|
||||||
|
. $internalArguments['inputFile']
|
||||||
|
. ' called: ' . $this->getPhpcsCall($internalArguments)
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$internalArguments['report'] = 'diff';
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->getExpectedDiffOutput($folder),
|
||||||
|
$this->getOutput($internalArguments)['output'],
|
||||||
|
'Fixing Sniff "' . $this->getSniffByFolder($folder) . '"'
|
||||||
|
. ' did not produce expected diff for input file '
|
||||||
|
. $internalArguments['inputFile']
|
||||||
|
. ' called: ' . $this->getPhpcsCall($internalArguments)
|
||||||
|
);
|
||||||
|
} catch (FileNotFoundException $e) {
|
||||||
|
// Ok, ignore, we don't have an diff.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get expected json output for comparison.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getExpectedJsonOutput(\SplFileInfo $folder)
|
||||||
|
{
|
||||||
|
$file = $folder->getPathname() . DIRECTORY_SEPARATOR . 'Expected.json';
|
||||||
|
if (!is_file($file)) {
|
||||||
|
throw new \Exception('Could not load file: ' . $file, 1491486050);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_decode(file_get_contents($file), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns absolute file path to diff file containing expected output.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
protected function getExpectedDiffOutput(\SplFileInfo $folder)
|
||||||
|
{
|
||||||
|
$file = $folder->getRealPath() . DIRECTORY_SEPARATOR . 'Expected.diff';
|
||||||
|
if (!is_file($file)) {
|
||||||
|
throw new FileNotFoundException('File does not exist.', 1491469621);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_get_contents($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns PHPCS Sniff name for given folder.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getSniffByFolder(\SplFileInfo $folder)
|
||||||
|
{
|
||||||
|
$folderParts = array_filter(explode(DIRECTORY_SEPARATOR, $folder->getPathName()));
|
||||||
|
$sniffNamePosition;
|
||||||
|
|
||||||
|
foreach ($folderParts as $index => $folderPart) {
|
||||||
|
if (strpos($folderPart, 'Sniff', 1) !== false) {
|
||||||
|
$sniffNamePosition = $index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sniffNamePosition === null) {
|
||||||
|
throw new \Exception('Could not detect sniff name by folder: ' . var_export($folder, true), 1491485369);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $folderParts[$sniffNamePosition - 3]
|
||||||
|
. '.' . $folderParts[$sniffNamePosition - 1]
|
||||||
|
. '.' . substr($folderParts[$sniffNamePosition], 0, -5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get absolute file path to file containing further arguments.
|
||||||
|
*
|
||||||
|
* @param \SplFileInfo $folder
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getArgumentsFile(\SplFileInfo $folder)
|
||||||
|
{
|
||||||
|
return $folder->getRealPath() . DIRECTORY_SEPARATOR . 'Arguments.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build cli call for phpcs.
|
||||||
|
*
|
||||||
|
* @param array $arguments
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getPhpcsCall(array $arguments)
|
||||||
|
{
|
||||||
|
$bin = './vendor/bin/phpcs';
|
||||||
|
$preparedArguments = [];
|
||||||
|
|
||||||
|
foreach ($arguments as $argumentName => $argumentValue) {
|
||||||
|
if ($argumentName === 'inputFile') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($argumentName === 'runtime-set') {
|
||||||
|
foreach ($argumentValue as $runtimeName => $runtimeValue) {
|
||||||
|
$preparedArguments[] = "--$argumentName $runtimeName $runtimeValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$preparedArguments[] = "--$argumentName=$argumentValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bin
|
||||||
|
. ' ' . implode(' ', $preparedArguments)
|
||||||
|
. ' ' . $arguments['inputFile']
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes phpcs for sniff based on $folder and returns the generated output.
|
||||||
|
*
|
||||||
|
* @param array $arguments
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getOutput(array $arguments)
|
||||||
|
{
|
||||||
|
$output = '';
|
||||||
|
$returnValue;
|
||||||
|
exec($this->getPhpcsCall($arguments), $output, $returnValue);
|
||||||
|
|
||||||
|
if ($arguments['report'] === 'json') {
|
||||||
|
try {
|
||||||
|
$output = $this->prepareJsonOutput($output);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \Exception(
|
||||||
|
'Error during preparing json output by invoking '
|
||||||
|
. $this->getPhpcsCall($arguments) . ' ' . $e->getMessage(),
|
||||||
|
1491487079
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} if ($arguments['report'] === 'diff') {
|
||||||
|
$output = $this->prepareDiffOutput($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'output' => $output,
|
||||||
|
'returnValue' => $returnValue,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare phpcs output for comparison.
|
||||||
|
*
|
||||||
|
* @param array $output
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function prepareJsonOutput(array $output)
|
||||||
|
{
|
||||||
|
$preparedOutput = json_decode($output[0], true);
|
||||||
|
|
||||||
|
if ($preparedOutput === null) {
|
||||||
|
throw new \Exception('Output for phpcs was not valid json: ' . var_export($output, true), 1491485173);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (array_keys($preparedOutput['files']) as $fileName) {
|
||||||
|
$newKey = basename($fileName);
|
||||||
|
$preparedOutput['files'][$newKey] = $preparedOutput['files'][$fileName];
|
||||||
|
unset($preparedOutput['files'][$fileName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $preparedOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare phpcs output for comparison.
|
||||||
|
*
|
||||||
|
* @param array $output
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function prepareDiffOutput(array $output)
|
||||||
|
{
|
||||||
|
return implode("\n", $output);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue