Merge remote-tracking branch 'origin/develop' into feature/82-30-migration
This commit is contained in:
commit
2fa66717d2
56 changed files with 964 additions and 83 deletions
|
@ -233,6 +233,50 @@ Using ``runtime-set``:
|
|||
|
||||
--runtime-set removedClassConfigFiles "/Some/Absolute/Path/*.yaml"
|
||||
|
||||
.. _configuration-removedExtensionConfigFiles:
|
||||
|
||||
removedExtensionConfigFiles
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Configure where to look for configuration files defining the removed extensions. Default is
|
||||
``Configuration/Removed/Extension/*.yaml`` inside the standard itself. We already try to deliver as
|
||||
much as possible. Globing is used, so placeholders like ``*`` are possible, see
|
||||
https://secure.php.net/manual/en/function.glob.php
|
||||
|
||||
Using :file:`ruleset.xml`:
|
||||
|
||||
.. code:: xml
|
||||
|
||||
<config name="removedExtensionConfigFiles" value="/Some/Absolute/Path/*.yaml"/>
|
||||
|
||||
Using ``runtime-set``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
--runtime-set removedExtensionConfigFiles "/Some/Absolute/Path/*.yaml"
|
||||
|
||||
.. _configuration-removedGlobalConfigFiles:
|
||||
|
||||
removedGlobalConfigFiles
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Configure where to look for configuration files defining the removed globals. Default is
|
||||
``Configuration/Removed/Globals/*.yaml`` inside the standard itself. We already try to deliver as
|
||||
much as possible. Globing is used, so placeholders like ``*`` are possible, see
|
||||
https://secure.php.net/manual/en/function.glob.php
|
||||
|
||||
Using :file:`ruleset.xml`:
|
||||
|
||||
.. code:: xml
|
||||
|
||||
<config name="removedGlobalConfigFiles" value="/Some/Absolute/Path/*.yaml"/>
|
||||
|
||||
Using ``runtime-set``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
--runtime-set removedGlobalConfigFiles "/Some/Absolute/Path/*.yaml"
|
||||
|
||||
.. _configuration-removedTypoScriptConfigFiles:
|
||||
|
||||
removedTypoScriptConfigFiles
|
||||
|
|
|
@ -106,6 +106,12 @@ functions. For configuration options see :ref:`configuration-removedConstantConf
|
|||
Check for usage of *removed PHP classes*. The classes are configured in same way as removed
|
||||
functions. For configuration options see :ref:`configuration-removedClassConfigFiles`.
|
||||
|
||||
Check for usage of *removed PHP globals*. The globals are configured in same way as removed
|
||||
functions. For configuration options see :ref:`configuration-removedGlobalConfigFiles`.
|
||||
|
||||
Check for usage of *removed TYPO3 extension*. For configuration options see
|
||||
:ref:`configuration-removedExtensionConfigFiles`.
|
||||
|
||||
Check for usage of *removed signals*. The signals are configured in same way as removed
|
||||
functions. For configuration options see :ref:`configuration-removedSignalConfigFiles`.
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
Typo3Update\Feature\RemovedExtensionFeature:
|
||||
- Typo3Update\Sniffs\Classname\InheritanceSniff
|
||||
- Typo3Update\Sniffs\Classname\InlineCommentSniff
|
||||
- Typo3Update\Sniffs\Classname\InstanceofSniff
|
||||
- Typo3Update\Sniffs\Classname\InstantiationWithMakeInstanceSniff
|
||||
- Typo3Update\Sniffs\Classname\InstantiationWithNewSniff
|
||||
- Typo3Update\Sniffs\Classname\InstantiationWithObjectManagerSniff
|
||||
- Typo3Update\Sniffs\Classname\IsACallSniff
|
||||
- Typo3Update\Sniffs\Classname\MissingVendorForPluginsAndModulesSniff
|
||||
- Typo3Update\Sniffs\Classname\PhpDocCommentSniff
|
||||
- Typo3Update\Sniffs\Classname\StaticCallSniff
|
||||
- Typo3Update\Sniffs\Classname\TypeHintCatchExceptionSniff
|
||||
- Typo3Update\Sniffs\Classname\TypeHintSniff
|
||||
- Typo3Update\Sniffs\Classname\UseSniff
|
|
@ -0,0 +1,6 @@
|
|||
# Breaking changes in 7.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Index.html#breaking-changes
|
||||
'7.0':
|
||||
perm:
|
||||
replacement: 'The logic is moved into EXT:beuser'
|
||||
docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html'
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Breaking changes in 7.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Index.html#breaking-changes
|
||||
'7.0':
|
||||
typo3CacheManager:
|
||||
replacement: 'Use GeneralUtility::makeInstance() instead'
|
||||
docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes'
|
||||
typo3CacheFactory:
|
||||
replacement: 'Use GeneralUtility::makeInstance() instead'
|
||||
docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes'
|
|
@ -21,12 +21,15 @@ namespace Typo3Update\Feature;
|
|||
*/
|
||||
|
||||
use PHP_CodeSniffer\Files\File as PhpCsFile;
|
||||
use Typo3Update\Sniffs\ExtendedPhpCsSupportTrait;
|
||||
|
||||
/**
|
||||
* Provides "feature" support for sniffs.
|
||||
*/
|
||||
trait FeaturesSupport
|
||||
{
|
||||
use ExtendedPhpCsSupportTrait;
|
||||
|
||||
/**
|
||||
* @return Features
|
||||
*/
|
||||
|
@ -44,6 +47,8 @@ trait FeaturesSupport
|
|||
*/
|
||||
public function processFeatures(PhpCsFile $phpcsFile, $stackPtr, $content)
|
||||
{
|
||||
$content = $this->getStringContent($content);
|
||||
|
||||
foreach ($this->getFeatures() as $featureClassName) {
|
||||
$feature = $this->createFeature($featureClassName);
|
||||
$feature->process($phpcsFile, $stackPtr, $content);
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
namespace Typo3Update\Feature;
|
||||
|
||||
/*
|
||||
* 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 PHP_CodeSniffer\Files\File as PhpCsFile;
|
||||
use Typo3Update\Options;
|
||||
|
||||
class RemovedExtensionFeature extends AbstractYamlRemovedUsage
|
||||
{
|
||||
public function process(PhpCsFile $phpcsFile, $classnamePosition, $classname)
|
||||
{
|
||||
$extname = $this->getExtnameFromClassname($classname);
|
||||
if ($extname === '' || $this->configured->isRemoved($extname) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addWarning(
|
||||
$phpcsFile,
|
||||
$classnamePosition,
|
||||
$this->configured->getRemoved($extname)
|
||||
);
|
||||
}
|
||||
|
||||
protected function getExtnameFromClassname($classname)
|
||||
{
|
||||
$classname = ltrim($classname, '\\');
|
||||
$classnameParts = array_filter(preg_split('/\\\\|_/', $classname));
|
||||
$classnameParts = array_values($classnameParts); // To reset key numbers of array.
|
||||
$extname = '';
|
||||
|
||||
if (count($classnameParts) <= 2) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$extname = $classnameParts[1];
|
||||
if (stripos($classname, 'TYPO3\CMS') === 0) {
|
||||
$extname = $classnameParts[2];
|
||||
}
|
||||
|
||||
return strtolower($extname);
|
||||
}
|
||||
|
||||
protected function prepareStructure(array $typo3Versions)
|
||||
{
|
||||
$newStructure = [];
|
||||
foreach ($typo3Versions as $typo3Version => $removals) {
|
||||
foreach ($removals as $removed => $config) {
|
||||
$config['name'] = $removed;
|
||||
$config['identifier'] = 'RemovedExtension:' . str_replace('\\', '_', ltrim($removed, '\\'));
|
||||
$config['versionRemoved'] = $typo3Version;
|
||||
$config['oldUsage'] = $removed;
|
||||
|
||||
$newStructure[$removed] = $config;
|
||||
}
|
||||
}
|
||||
|
||||
return $newStructure;
|
||||
}
|
||||
|
||||
protected function getRemovedConfigFiles()
|
||||
{
|
||||
return Options::getRemovedExtensionConfigFiles();
|
||||
}
|
||||
}
|
|
@ -56,6 +56,17 @@ class Options
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function getRemovedExtensionConfigFiles()
|
||||
{
|
||||
return static::getOptionFileNames(
|
||||
'removedExtensionConfigFiles',
|
||||
__DIR__ . '/Configuration/Removed/Extension/*.yaml'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of absolute file names containing removed function configurations.
|
||||
*
|
||||
|
@ -147,6 +158,19 @@ class Options
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of absolute file names containing removed globals configurations.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function getRemovedGlobalConfigFiles()
|
||||
{
|
||||
return static::getOptionFileNames(
|
||||
'removedGlobalConfigFiles',
|
||||
__DIR__ . '/Configuration/Removed/Globals/*.yaml'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the option by optionName, if not defined, use default.
|
||||
*
|
||||
|
|
|
@ -62,19 +62,75 @@ abstract class AbstractClassnameChecker implements PhpCsSniff
|
|||
*/
|
||||
public function process(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$tokens = $phpcsFile->getTokens();
|
||||
|
||||
if ($this->shouldLookBefore()) {
|
||||
$classnamePosition = $phpcsFile->findPrevious(T_STRING, $stackPtr);
|
||||
} else {
|
||||
$classnamePosition = $phpcsFile->findNext(T_STRING, $stackPtr);
|
||||
}
|
||||
|
||||
if ($classnamePosition === false) {
|
||||
try {
|
||||
if ($this->shouldLookBefore()) {
|
||||
list($classnamePosition, $classname) = $this->getBefore($phpcsFile, $stackPtr);
|
||||
} else {
|
||||
list($classnamePosition, $classname) = $this->getAfter($phpcsFile, $stackPtr);
|
||||
}
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classname = $tokens[$classnamePosition]['content'];
|
||||
$this->processFeatures($phpcsFile, $classnamePosition, $classname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get position and classname before current stack pointer.
|
||||
*
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr The position in the stack where
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getBefore(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$possibleStart = $phpcsFile->findPrevious([
|
||||
T_STRING, T_NS_SEPARATOR,
|
||||
], $stackPtr - 1, null, true, null, true);
|
||||
if ($possibleStart === false) {
|
||||
throw new \UnexpectedValueException('Could not find start of classname.', 1494319966);
|
||||
}
|
||||
|
||||
$classnamePosition = $phpcsFile->findNext(T_STRING, $possibleStart);
|
||||
if ($classnamePosition === false) {
|
||||
throw new \UnexpectedValueException('Could not find start of classname.', 1494319966);
|
||||
}
|
||||
|
||||
$end = $phpcsFile->findNext([
|
||||
T_STRING, T_NS_SEPARATOR
|
||||
], $classnamePosition + 1, $stackPtr + 1, true, null, true);
|
||||
if ($end === false) {
|
||||
throw new \UnexpectedValueException('Could not find end of classname.', 1494319651);
|
||||
}
|
||||
|
||||
$classname = $phpcsFile->getTokensAsString($classnamePosition, $end - $classnamePosition);
|
||||
|
||||
return [$classnamePosition, $classname];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get position and classname after current stack pointer.
|
||||
*
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr The position in the stack where
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAfter(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$classnamePosition = $phpcsFile->findNext(T_STRING, $stackPtr);
|
||||
if ($classnamePosition === false) {
|
||||
throw new \UnexpectedValueException('Could not find start of classname.', 1494319665);
|
||||
}
|
||||
|
||||
$end = $phpcsFile->findNext([T_STRING, T_NS_SEPARATOR], $classnamePosition, null, true, null, true);
|
||||
if ($end === false) {
|
||||
throw new \UnexpectedValueException('Could not find end of classname.', 1494319651);
|
||||
}
|
||||
|
||||
$classname = $phpcsFile->getTokensAsString($classnamePosition, $end - $classnamePosition);
|
||||
|
||||
return [$classnamePosition, $classname];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,19 @@ class InheritanceSniff extends AbstractClassnameChecker
|
|||
return;
|
||||
}
|
||||
|
||||
$lastPosition = $phpcsFile->findNext(T_OPEN_CURLY_BRACKET, $stackPtr);
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
$position = $phpcsFile->findNext(T_STRING, $stackPtr, null, false, $interface);
|
||||
if ($position === false) {
|
||||
continue;
|
||||
}
|
||||
$interface = trim($interface, '\\');
|
||||
$position = $stackPtr;
|
||||
|
||||
do {
|
||||
try {
|
||||
list($position, $classname) = $this->getAfter($phpcsFile, $position + 1);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
continue 2;
|
||||
}
|
||||
} while ($classname !== $interface && $position <= $lastPosition);
|
||||
|
||||
$this->processFeatures($phpcsFile, $position, $interface);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class InstantiationWithMakeInstanceSniff extends AbstractClassnameChecker
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
return Tokens::$functionNameTokens;
|
||||
return [T_STRING];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,13 +58,12 @@ class InstantiationWithMakeInstanceSniff extends AbstractClassnameChecker
|
|||
return;
|
||||
}
|
||||
|
||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr);
|
||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr, null, false, null, true);
|
||||
if ($classnamePosition === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classname = $tokens[$classnamePosition]['content'];
|
||||
$this->originalTokenContent = $tokens[$classnamePosition]['content'];
|
||||
$this->processFeatures($phpcsFile, $classnamePosition, $classname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,10 +52,18 @@ class TypeHintSniff extends AbstractClassnameChecker
|
|||
continue;
|
||||
}
|
||||
|
||||
$position = $phpcsFile->findPrevious(T_STRING, $parameter['token'], $stackPtr, false, null, true);
|
||||
$position = $phpcsFile->findPrevious([
|
||||
T_OPEN_PARENTHESIS, T_COMMA
|
||||
], $parameter['token'] - 2, $stackPtr, false, null, true);
|
||||
if ($position === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$position = $phpcsFile->findNext(T_STRING, $position);
|
||||
if ($position === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->processFeatures($phpcsFile, $position, $parameter['type_hint']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,28 @@ use PHP_CodeSniffer\Util\Tokens as Tokens;
|
|||
*/
|
||||
trait ExtendedPhpCsSupportTrait
|
||||
{
|
||||
/**
|
||||
* Check whether variable at $stackPtr is global.
|
||||
*
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isGlobalVariable(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$position = $phpcsFile->findPrevious(T_GLOBAL, $stackPtr, null, false, null, true);
|
||||
if ($position !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($phpcsFile->getTokens()[$stackPtr]['content'] === '$GLOBALS') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether current stackPtr is a function call.
|
||||
*
|
||||
|
@ -68,10 +90,6 @@ trait ExtendedPhpCsSupportTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all parameters for function call as values.
|
||||
* Quotes are removed from strings.
|
||||
*
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr
|
||||
*
|
||||
* @return array<string>
|
||||
|
|
|
@ -33,6 +33,27 @@ abstract class AbstractGenericUsage extends BaseAbstractYamlRemovedUsage impleme
|
|||
*/
|
||||
abstract protected function findRemoved(PhpCsFile $phpcsFile, $stackPtr);
|
||||
|
||||
/**
|
||||
* @param array $typo3Versions
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareStructure(array $typo3Versions)
|
||||
{
|
||||
$newStructure = [];
|
||||
|
||||
foreach ($typo3Versions as $typo3Version => $removals) {
|
||||
foreach ($removals as $removed => $config) {
|
||||
$config['name'] = $removed;
|
||||
$config['identifier'] = $removed;
|
||||
$config['oldUsage'] = $removed;
|
||||
$config['versionRemoved'] = $typo3Version;
|
||||
$newStructure[$removed] = $config;
|
||||
}
|
||||
}
|
||||
|
||||
return $newStructure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr
|
||||
|
|
63
src/Standards/Typo3Update/Sniffs/Removed/ExtensionSniff.php
Normal file
63
src/Standards/Typo3Update/Sniffs/Removed/ExtensionSniff.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace Typo3Update\Sniffs\Removed;
|
||||
|
||||
/*
|
||||
* 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 PHP_CodeSniffer\Files\File as PhpCsFile;
|
||||
use Typo3Update\Options;
|
||||
use Typo3Update\Sniffs\ExtendedPhpCsSupportTrait;
|
||||
|
||||
class ExtensionSniff extends AbstractGenericUsage
|
||||
{
|
||||
use ExtendedPhpCsSupportTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $methodsToCheck = ['isLoaded', 'extPath', 'extRelPath', 'getCN', 'getExtensionVersion'];
|
||||
|
||||
public function register()
|
||||
{
|
||||
return [T_STRING];
|
||||
}
|
||||
|
||||
protected function getRemovedConfigFiles()
|
||||
{
|
||||
return Options::getRemovedExtensionConfigFiles();
|
||||
}
|
||||
|
||||
protected function findRemoved(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$token = $phpcsFile->getTokens()[$stackPtr];
|
||||
if (!$this->isFunctionCall($phpcsFile, $stackPtr)
|
||||
|| !in_array($token['content'], $this->methodsToCheck)
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$arguments = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
|
||||
if ($this->configured->isRemoved($arguments[0])) {
|
||||
return [$this->configured->getRemoved($arguments[0])];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace Typo3Update\Sniffs\Removed;
|
||||
|
||||
/*
|
||||
* 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 PHP_CodeSniffer\Files\File as PhpCsFile;
|
||||
use Typo3Update\Options;
|
||||
use Typo3Update\Sniffs\ExtendedPhpCsSupportTrait;
|
||||
|
||||
class GenericGlobalSniff extends AbstractGenericUsage
|
||||
{
|
||||
use ExtendedPhpCsSupportTrait;
|
||||
|
||||
public function register()
|
||||
{
|
||||
return [T_VARIABLE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PhpCsFile $phpcsFile
|
||||
* @param int $stackPtr
|
||||
* @return array
|
||||
*/
|
||||
protected function findRemoved(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
if ($this->isGlobalVariable($phpcsFile, $stackPtr) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$variableName = substr($phpcsFile->getTokens()[$stackPtr]['content'], 1);
|
||||
if ($variableName === 'GLOBALS') {
|
||||
$variableName = trim(
|
||||
$phpcsFile->getTokens()[$phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr)]['content'],
|
||||
'\'"'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->configured->isRemoved($variableName)) {
|
||||
return [$this->configured->getRemoved($variableName)];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getRemovedConfigFiles()
|
||||
{
|
||||
return Options::getRemovedGlobalConfigFiles();
|
||||
}
|
||||
}
|
|
@ -43,23 +43,6 @@ class TypoScriptConstantSniff extends AbstractGenericUsage
|
|||
];
|
||||
}
|
||||
|
||||
protected function prepareStructure(array $typo3Versions)
|
||||
{
|
||||
$newStructure = [];
|
||||
|
||||
foreach ($typo3Versions as $typo3Version => $removals) {
|
||||
foreach ($removals as $removed => $config) {
|
||||
$config['name'] = $removed;
|
||||
$config['identifier'] = $removed;
|
||||
$config['oldUsage'] = $removed;
|
||||
$config['versionRemoved'] = $typo3Version;
|
||||
$newStructure[$removed] = $config;
|
||||
}
|
||||
}
|
||||
|
||||
return $newStructure;
|
||||
}
|
||||
|
||||
protected function findRemoved(PhpCsFile $phpcsFile, $stackPtr)
|
||||
{
|
||||
$removed = [];
|
||||
|
|
|
@ -56,14 +56,41 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Inheritance.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 35,
|
||||
"fixable": false,
|
||||
"line": 34,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Inheritance.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 6,
|
||||
"fixable": false,
|
||||
"line": 35,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Inheritance.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 5,
|
||||
"fixable": false,
|
||||
"line": 36,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Inheritance.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 6,
|
||||
"fixable": 6,
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,3 +30,10 @@ class InputFileForIssues extends Tx_Extbase_Configuration_Configurationmanager i
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
class InputFileForIssues extends \TYPO3\CMS\Perm\Controller\PermissionAjaxController implements
|
||||
\TYPO3\CMS\Perm\Controller\PermissionAjaxController,
|
||||
TYPO3\CMS\Perm\Controller\PermissionModuleController
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
- // @var Tx_Extbase_Command_HelpCommandController $variable
|
||||
+ // @var \TYPO3\CMS\Extbase\Command\HelpCommandController $variable
|
||||
$variable;
|
||||
}
|
||||
}
|
||||
|
||||
/* @var $variable TYPO3\CMS\Perm\Controller\PermissionAjaxController */
|
||||
|
|
|
@ -38,14 +38,50 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InlineComment.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 9,
|
||||
"fixable": false,
|
||||
"line": 38,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InlineComment.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 9,
|
||||
"fixable": false,
|
||||
"line": 41,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InlineComment.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 9,
|
||||
"fixable": false,
|
||||
"line": 44,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InlineComment.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 9,
|
||||
"fixable": false,
|
||||
"line": 47,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InlineComment.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 4
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 4,
|
||||
"fixable": 4,
|
||||
"warnings": 0
|
||||
"warnings": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,5 +34,17 @@ class InputFileForIssues
|
|||
|
||||
// @var Tx_Extbase_Command_HelpCommandController $variable
|
||||
$variable;
|
||||
|
||||
/* @var $variable TYPO3\CMS\Perm\Controller\PermissionAjaxController */
|
||||
$variable;
|
||||
|
||||
// @var $variable \TYPO3\CMS\Perm\Controller\PermissionAjaxController
|
||||
$variable;
|
||||
|
||||
/* @var \TYPO3\CMS\Perm\Controller\PermissionAjaxController $variable */
|
||||
$variable;
|
||||
|
||||
// @var TYPO3\CMS\Perm\Controller\PermissionAjaxController $variable
|
||||
$variable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstanceofSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -19,6 +19,6 @@
|
||||
@@ -19,7 +19,7 @@
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
@ -8,3 +8,4 @@
|
|||
+if ($a instanceof \TYPO3\CMS\Core\SingletonInterface) {
|
||||
// do something
|
||||
}
|
||||
if ($a instanceof \TYPO3\CMS\Perm\Controller\PermissionAjaxController) {
|
||||
|
|
|
@ -11,14 +11,32 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Instanceof.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 20,
|
||||
"fixable": false,
|
||||
"line": 25,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Instanceof.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 19,
|
||||
"fixable": false,
|
||||
"line": 28,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Instanceof.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 1,
|
||||
"fixable": 1,
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,3 +22,9 @@
|
|||
if ($a instanceof t3lib_Singleton) {
|
||||
// do something
|
||||
}
|
||||
if ($a instanceof \TYPO3\CMS\Perm\Controller\PermissionAjaxController) {
|
||||
// do something
|
||||
}
|
||||
if ($a instanceof TYPO3\CMS\Perm\Controller\PermissionAjaxController) {
|
||||
// do something
|
||||
}
|
||||
|
|
|
@ -11,14 +11,23 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithMakeInstance.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 25,
|
||||
"fixable": false,
|
||||
"line": 27,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithMakeInstance.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 1,
|
||||
"fixable": 1,
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,3 +23,5 @@ t3lib_div::makeInstance('Tx_Extbase_Command_HelpCommandController');
|
|||
t3lib_div::makeInstance(\TYPO3\CMS\Core\Resource\Service\IndexerService::class);
|
||||
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||
t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class);
|
||||
|
||||
t3lib_div::makeInstance('TYPO3\CMS\Perm\Controller\PermissionAjaxController');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithNewSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -19,13 +19,13 @@
|
||||
@@ -19,14 +19,14 @@
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
@ -20,3 +20,4 @@
|
|||
+(new \TYPO3\CMS\Extbase\Command\HelpCommandController)
|
||||
->doSomething()
|
||||
;
|
||||
|
||||
|
|
|
@ -56,14 +56,32 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithNew.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 5,
|
||||
"fixable": false,
|
||||
"line": 33,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithNew.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 7,
|
||||
"fixable": false,
|
||||
"line": 34,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithNew.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 6,
|
||||
"fixable": 6,
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,3 +29,8 @@ new Tx_Extbase_Command_HelpCommandController;
|
|||
(new Tx_Extbase_Command_HelpCommandController)
|
||||
->doSomething()
|
||||
;
|
||||
|
||||
new TYPO3\CMS\Perm\Controller\PermissionAjaxController;
|
||||
(new \TYPO3\CMS\Perm\Controller\PermissionAjaxController)
|
||||
->doSomething()
|
||||
;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithObjectManagerSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -21,13 +21,13 @@
|
||||
@@ -21,16 +21,16 @@
|
||||
|
||||
// Not handled by this sniff, but StaticCallSniff, as this uses double colon.
|
||||
$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class);
|
||||
|
@ -18,3 +18,6 @@
|
|||
\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('\TYPO3\CMS\Perm\Controller\PermissionAjaxController');
|
||||
|
|
|
@ -38,14 +38,32 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithObjectManager.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 11,
|
||||
"fixable": false,
|
||||
"line": 36,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithObjectManager.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 27,
|
||||
"fixable": false,
|
||||
"line": 37,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.InstantiationWithObjectManager.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 4,
|
||||
"fixable": 4,
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,3 +31,7 @@ $this->objectManager->get('Tx_Extbase_Command_HelpCommandController');
|
|||
->get('\Tx_Extbase_Command_HelpCommandController');
|
||||
\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('\TYPO3\CMS\Perm\Controller\PermissionAjaxController');
|
||||
$this->objectManager->get('TYPO3\CMS\Perm\Controller\PermissionAjaxController');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/IsACallSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -23,15 +23,15 @@
|
||||
@@ -23,16 +23,16 @@
|
||||
if (is_a($a, t3lib_Singleton::class)) {
|
||||
// do something
|
||||
}
|
||||
|
@ -20,3 +20,4 @@
|
|||
+if (is_a($a, "\\TYPO3\\CMS\\Core\\SingletonInterface")) {
|
||||
// do something
|
||||
}
|
||||
if (is_a($a, "\\TYPO3\CMS\Perm\Controller\PermissionAjaxController")) {
|
||||
|
|
|
@ -38,14 +38,23 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.IsACall.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 14,
|
||||
"fixable": false,
|
||||
"line": 38,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.IsACall.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 4,
|
||||
"fixable": 4,
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,3 +35,6 @@ if (is_a($a, "t3lib_Singleton")) {
|
|||
if (is_a($a, "\\t3lib_Singleton")) {
|
||||
// do something
|
||||
}
|
||||
if (is_a($a, "\\TYPO3\CMS\Perm\Controller\PermissionAjaxController")) {
|
||||
// do something
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/PhpDocCommentSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -22,26 +22,26 @@
|
||||
@@ -22,27 +22,27 @@
|
||||
class InputFileForIssues
|
||||
{
|
||||
/**
|
||||
|
@ -22,6 +22,7 @@
|
|||
- * @param t3lib_div
|
||||
+ * @param \TYPO3\CMS\Core\Utility\GeneralUtility
|
||||
* @param \TYPO3\CMS\Backend\Template\MediumDocumentTemplate
|
||||
* @param \TYPO3\CMS\Perm\Controller\PermissionAjaxController
|
||||
*
|
||||
- * @return Tx_Extbase_Configuration_Configurationmanager
|
||||
+ * @return \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
|
||||
|
|
|
@ -49,19 +49,19 @@
|
|||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 16,
|
||||
"fixable": true,
|
||||
"line": 40,
|
||||
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
|
||||
"column": 15,
|
||||
"fixable": false,
|
||||
"line": 39,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.PhpDocComment.legacyClassname",
|
||||
"type": "ERROR"
|
||||
"source": "Typo3Update.Classname.PhpDocComment.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 18,
|
||||
"column": 16,
|
||||
"fixable": true,
|
||||
"line": 44,
|
||||
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
|
||||
"line": 41,
|
||||
"message": "Legacy classes are not allowed; found \"Tx_Extbase_Configuration_Configurationmanager\", use \"TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager\" instead",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.PhpDocComment.legacyClassname",
|
||||
"type": "ERROR"
|
||||
|
@ -74,14 +74,23 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.PhpDocComment.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 18,
|
||||
"fixable": true,
|
||||
"line": 46,
|
||||
"message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.PhpDocComment.legacyClassname",
|
||||
"type": "ERROR"
|
||||
}
|
||||
],
|
||||
"warnings": 1
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 7,
|
||||
"fixable": 7,
|
||||
"warnings": 1
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ class InputFileForIssues
|
|||
/**
|
||||
* @param t3lib_div
|
||||
* @param \TYPO3\CMS\Backend\Template\MediumDocumentTemplate
|
||||
* @param \TYPO3\CMS\Perm\Controller\PermissionAjaxController
|
||||
*
|
||||
* @return Tx_Extbase_Configuration_Configurationmanager
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/StaticCallSniff/InputFileForIssues.php
|
||||
+++ PHP_CodeSniffer
|
||||
@@ -19,13 +19,13 @@
|
||||
@@ -19,16 +19,16 @@
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
@ -19,3 +19,6 @@
|
|||
-is_a($a, t3lib_Singleton::class);
|
||||
+ ->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
|
||||
+is_a($a, \TYPO3\CMS\Core\SingletonInterface::class);
|
||||
|
||||
\TYPO3\CMS\Perm\Controller\PermissionAjaxController::configurePlugin(
|
||||
$_EXTKEY,
|
||||
|
|
|
@ -56,14 +56,32 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.StaticCall.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 2,
|
||||
"fixable": false,
|
||||
"line": 33,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.StaticCall.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 28,
|
||||
"fixable": false,
|
||||
"line": 38,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.StaticCall.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 6,
|
||||
"fixable": 6,
|
||||
"warnings": 0
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,3 +29,10 @@ $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);
|
||||
|
||||
\TYPO3\CMS\Perm\Controller\PermissionAjaxController::configurePlugin(
|
||||
$_EXTKEY,
|
||||
'name',
|
||||
['Controller' => 'action']
|
||||
);
|
||||
$this->objectManager->get(\TYPO3\CMS\Perm\Controller\PermissionAjaxController::class);
|
||||
|
|
|
@ -20,14 +20,23 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHintCatchException.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 11,
|
||||
"fixable": false,
|
||||
"line": 48,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHintCatchException.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 2,
|
||||
"fixable": 2,
|
||||
"warnings": 0
|
||||
"warnings": 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,3 +42,9 @@ try {
|
|||
} catch (TYPO3\CMS\Extbase\Exception $e) {
|
||||
// else
|
||||
}
|
||||
|
||||
try {
|
||||
// something
|
||||
} catch (\TYPO3\CMS\Perm\Controller\PermissionAjaxController $e) {
|
||||
// else
|
||||
}
|
||||
|
|
|
@ -38,4 +38,4 @@
|
|||
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,14 +56,41 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHint.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 31,
|
||||
"fixable": false,
|
||||
"line": 63,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHint.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 96,
|
||||
"fixable": false,
|
||||
"line": 63,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHint.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 31,
|
||||
"fixable": false,
|
||||
"line": 66,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.TypeHint.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 6,
|
||||
"fixable": 6,
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,4 +59,11 @@ class SomeClass
|
|||
public function something(Tx_Extbase_Domain_Model_Backenduser $user)
|
||||
{
|
||||
}
|
||||
|
||||
public function something(TYPO3\CMS\Perm\Controller\PermissionAjaxController $controller, \Tx_Perm_Controller_PermissionAjaxController $controller)
|
||||
{
|
||||
}
|
||||
public function something(Tx_Perm_Controller_PermissionAjaxController $controller)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
+use TYPO3\CMS\Extbase\Domain\Model\BackendUser;
|
||||
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||
use \TYPO3\CMS\Extbase\Mvc\Cli\Command;
|
||||
|
||||
use TYPO3\CMS\Perm\Controller\PermissionAjaxController;
|
||||
|
|
|
@ -20,14 +20,41 @@
|
|||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Use.legacyClassname",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"column": 5,
|
||||
"fixable": false,
|
||||
"line": 26,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Use.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 6,
|
||||
"fixable": false,
|
||||
"line": 27,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Use.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 5,
|
||||
"fixable": false,
|
||||
"line": 28,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Classname.Use.RemovedExtension:perm",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 2,
|
||||
"fixable": 2,
|
||||
"warnings": 0
|
||||
"warnings": 3
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,6 @@ 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;
|
||||
|
||||
use TYPO3\CMS\Perm\Controller\PermissionAjaxController;
|
||||
use \Tx_Perm_Controller_PermissionAjaxController;
|
||||
use Tx_Perm_Controller_PermissionAjaxController;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"files": {
|
||||
"InputFileForIssues.php": {
|
||||
"errors": 0,
|
||||
"messages": [
|
||||
{
|
||||
"column": 53,
|
||||
"fixable": false,
|
||||
"line": 22,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Removed.Extension.perm",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 53,
|
||||
"fixable": false,
|
||||
"line": 23,
|
||||
"message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Removed.Extension.perm",
|
||||
"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.
|
||||
*/
|
||||
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('perm');
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('perm');
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"files": {
|
||||
"InputFileForIssues.php": {
|
||||
"errors": 0,
|
||||
"messages": [
|
||||
{
|
||||
"column": 12,
|
||||
"fixable": false,
|
||||
"line": 24,
|
||||
"message": "Calls to removed code are not allowed; found typo3CacheFactory. Removed in 7.0. Use GeneralUtility::makeInstance() instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Removed.GenericGlobal.typo3CacheFactory",
|
||||
"type": "WARNING"
|
||||
},
|
||||
{
|
||||
"column": 26,
|
||||
"fixable": false,
|
||||
"line": 25,
|
||||
"message": "Calls to removed code are not allowed; found typo3CacheManager. Removed in 7.0. Use GeneralUtility::makeInstance() instead. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes",
|
||||
"severity": 5,
|
||||
"source": "Typo3Update.Removed.GenericGlobal.typo3CacheManager",
|
||||
"type": "WARNING"
|
||||
}
|
||||
],
|
||||
"warnings": 2
|
||||
}
|
||||
},
|
||||
"totals": {
|
||||
"errors": 0,
|
||||
"fixable": 0,
|
||||
"warnings": 2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?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 name()
|
||||
{
|
||||
global $typo3CacheFactory;
|
||||
$typo3CacheManager = $GLOBALS['typo3CacheManager'];
|
||||
$typo3CacheManager->something();
|
||||
}
|
28
tests/Sniffs/Removed/ExtensionSniffTest.php
Normal file
28
tests/Sniffs/Removed/ExtensionSniffTest.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Typo3Update\Tests\Sniffs\Removed;
|
||||
|
||||
/*
|
||||
* 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 Typo3Update\Tests\SniffsTest;
|
||||
|
||||
class ExtensionSniffTest extends SniffsTest
|
||||
{
|
||||
}
|
28
tests/Sniffs/Removed/GenericGlobalSniffTest.php
Normal file
28
tests/Sniffs/Removed/GenericGlobalSniffTest.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Typo3Update\Tests\Sniffs\Removed;
|
||||
|
||||
/*
|
||||
* 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 Typo3Update\Tests\SniffsTest;
|
||||
|
||||
class GenericGlobalSniffTest extends SniffsTest
|
||||
{
|
||||
}
|
Loading…
Reference in a new issue