From 293a6570a89ff1f7912084864d3a22975ef78bd4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 09:27:42 +0200 Subject: [PATCH 01/16] FEATURE: Add sniff to check for Breaking: #69916 Relates: #33 --- .../Deprecated/AjaxRegistrationSniff.php | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php new file mode 100644 index 0000000..73a2061 --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php @@ -0,0 +1,96 @@ + + * + * 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_File as PhpCsFile; +use PHP_CodeSniffer_Sniff as PhpCsSniff; +use PHP_CodeSniffer_Tokens as PhpCsTokens; + +/** + */ +class Typo3Update_Sniffs_Deprecated_AjaxRegistrationSniff implements PhpCsSniff +{ + /** + * Defines files to check. + * As soon as PHP_CS 3 is used, define them in ruleset.xml. + * + * @var array + */ + public $filenamesToCheck = [ + 'ext_tables.php', + 'ext_localconf.php', + ]; + + /** + * Returns the token types that this sniff is interested in. + * + * @return array + */ + public function register() + { + return PhpCsTokens::$stringTokens; + } + + /** + * Processes the tokens that this sniff is interested in. + * + * @param PhpCsFile $phpcsFile The file where the token was found. + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process(PhpCsFile $phpcsFile, $stackPtr) + { + if (in_array(basename($phpcsFile->getFilename()), $this->filenamesToCheck) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + if ($tokens[$stackPtr]['content'] !== "'AJAX'") { + return; + } + $equalSign = $phpcsFile->findNext(T_EQUAL, $stackPtr, null, false, null, true); + if ($equalSign === false) { + return; + } + $tokenToCheck = $phpcsFile->findNext(T_WHITESPACE, $equalSign + 1, null, true, null, true); + if ($tokenToCheck === false) { + return; + } + $token = $tokens[$tokenToCheck]; + if ($token['code'] !== T_CONSTANT_ENCAPSED_STRING) { + return; + } + + $phpcsFile->addWarning( + "Defining AJAX using %s is no longer supported with a single String like %s.\n" + . "Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests.\n" + . 'See: %s', + $tokenToCheck, + '', + [ + "\$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][\$ajaxID]", + $token['content'], + 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html' + ] + ); + } +} From 2118d86879c15d1cadbffefe809beb2d4f671db6 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 10:31:30 +0200 Subject: [PATCH 02/16] WIP|FEATURE: First working check for deprecated functions * Provide a generic sniff with configuration (property) containing all deprecated calls. * Check function calls and provide warning with information. Relates: #33 --- .../Deprecated/AbstractFunctionCall.php | 95 +++++++++++++++++++ .../Deprecated/GenericFunctionCallSniff.php | 60 ++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php create mode 100644 src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php new file mode 100644 index 0000000..30fb56a --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php @@ -0,0 +1,95 @@ + + * + * 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_File as PhpCsFile; +use PHP_CodeSniffer_Sniff as PhpCsSniff; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * + */ +abstract class AbstractFunctionCall implements PhpCsSniff +{ + use \Typo3Update\Sniffs\ExtendedPhpCsSupportTrait; + + abstract protected function getFunctionNames(); + abstract protected function getOldFunctionCall($functionName); + abstract protected function getNewFunctionCall($functionName); + abstract protected function getDocsUrl($functionName); + + /** + * Returns the token types that this sniff is interested in. + * + * @return array + */ + public function register() + { + return Tokens::$functionNameTokens; + } + + /** + * Processes the tokens that this sniff is interested in. + * + * This is the default implementation, as most of the time next T_STRING is + * the class name. This way only the register method has to be registered + * in default cases. + * + * @param PhpCsFile $phpcsFile The file where the token was found. + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process(PhpCsFile $phpcsFile, $stackPtr) + { + if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + if (in_array($token['content'], $this->getFunctionNames()) === false) { + return; + } + + $this->addWarning($phpcsFile, $stackPtr); + } + + protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) + { + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$tokenPosition]; + $functionCall = $token['content']; + + $phpcsFile->addWarning( + 'Legacy function calls are not allowed; found %s. %s. See: %s', + $tokenPosition, + 'legacyFunctioncall', + [ + $this->getOldFunctionCall($functionCall), + $this->getNewFunctionCall($functionCall), + $this->getDocsUrl($functionCall), + ] + ); + } +} diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php new file mode 100644 index 0000000..e801ea4 --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -0,0 +1,60 @@ + + * + * 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_File as PhpCsFile; +use Typo3Update\Sniffs\Deprecated\AbstractFunctionCall; + +/** + */ +class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff extends AbstractFunctionCall +{ + protected $deprecatedFunctions = [ + 'loadTCA' => [ + 'oldFunctionCall' => '\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA()', + 'newFunctionCall' => null, + 'docsUrl' => 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html', + ], + ]; + + protected function getFunctionNames() + { + return array_keys($this->deprecatedFunctions); + } + + protected function getOldFunctionCall($functionName) + { + return $this->deprecatedFunctions[$functionName]['oldFunctionCall']; + } + + protected function getNewFunctionCall($functionName) + { + $newCall = $this->deprecatedFunctions[$functionName]['newFunctionCall']; + if ($newCall !== null) { + return $newCall; + } + return 'There is no replacement, just remove call'; + } + + protected function getDocsUrl($functionName) + { + return $this->deprecatedFunctions[$functionName]['docsUrl']; + } +} From 65773c88b5673f15f9df3b07521e0e584f233a6d Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 10:57:35 +0200 Subject: [PATCH 03/16] WIP|FEATURE: Provide first deprecation function sniff * Use a single generic sniff with configuration. Relates: #33 --- .../Deprecated/AbstractFunctionCall.php | 95 --------------- .../Deprecated/GenericFunctionCallSniff.php | 111 +++++++++++++++++- 2 files changed, 109 insertions(+), 97 deletions(-) delete mode 100644 src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php deleted file mode 100644 index 30fb56a..0000000 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/AbstractFunctionCall.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * 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_File as PhpCsFile; -use PHP_CodeSniffer_Sniff as PhpCsSniff; -use PHP_CodeSniffer_Tokens as Tokens; - -/** - * - */ -abstract class AbstractFunctionCall implements PhpCsSniff -{ - use \Typo3Update\Sniffs\ExtendedPhpCsSupportTrait; - - abstract protected function getFunctionNames(); - abstract protected function getOldFunctionCall($functionName); - abstract protected function getNewFunctionCall($functionName); - abstract protected function getDocsUrl($functionName); - - /** - * Returns the token types that this sniff is interested in. - * - * @return array - */ - public function register() - { - return Tokens::$functionNameTokens; - } - - /** - * Processes the tokens that this sniff is interested in. - * - * This is the default implementation, as most of the time next T_STRING is - * the class name. This way only the register method has to be registered - * in default cases. - * - * @param PhpCsFile $phpcsFile The file where the token was found. - * @param int $stackPtr The position in the stack where - * the token was found. - * - * @return void - */ - public function process(PhpCsFile $phpcsFile, $stackPtr) - { - if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { - return; - } - - $tokens = $phpcsFile->getTokens(); - $token = $tokens[$stackPtr]; - - if (in_array($token['content'], $this->getFunctionNames()) === false) { - return; - } - - $this->addWarning($phpcsFile, $stackPtr); - } - - protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) - { - $tokens = $phpcsFile->getTokens(); - $token = $tokens[$tokenPosition]; - $functionCall = $token['content']; - - $phpcsFile->addWarning( - 'Legacy function calls are not allowed; found %s. %s. See: %s', - $tokenPosition, - 'legacyFunctioncall', - [ - $this->getOldFunctionCall($functionCall), - $this->getNewFunctionCall($functionCall), - $this->getDocsUrl($functionCall), - ] - ); - } -} diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index e801ea4..d6cd39a 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -20,12 +20,25 @@ */ use PHP_CodeSniffer_File as PhpCsFile; -use Typo3Update\Sniffs\Deprecated\AbstractFunctionCall; +use PHP_CodeSniffer_Sniff as PhpCsSniff; +use PHP_CodeSniffer_Tokens as Tokens; /** + * Sniff that handles all calls to deprecated functions. + * + * A single array defines the deprecations, see $deprecatedFunctions. */ -class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff extends AbstractFunctionCall +class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSniff { + use \Typo3Update\Sniffs\ExtendedPhpCsSupportTrait; + + /** + * Configuration to define deprecated functions. + * + * Keys have to match the function name. + * + * @var array + */ protected $deprecatedFunctions = [ 'loadTCA' => [ 'oldFunctionCall' => '\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA()', @@ -34,16 +47,105 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff extends AbstractFun ], ]; + /** + * Returns the token types that this sniff is interested in. + * + * @return array + */ + public function register() + { + return Tokens::$functionNameTokens; + } + + /** + * Processes the tokens that this sniff is interested in. + * + * This is the default implementation, as most of the time next T_STRING is + * the class name. This way only the register method has to be registered + * in default cases. + * + * @param PhpCsFile $phpcsFile The file where the token was found. + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process(PhpCsFile $phpcsFile, $stackPtr) + { + if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + if (in_array($token['content'], $this->getFunctionNames()) === false) { + return; + } + + $this->addWarning($phpcsFile, $stackPtr); + } + + /** + * Add warning for the given token position. + * + * @param PhpCsFile $phpcsFile + * @param int $tokenPosition + * + * @return void + */ + protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) + { + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$tokenPosition]; + $functionCall = $token['content']; + + $phpcsFile->addWarning( + "Legacy function calls are not allowed; found %s.\n" + . "%s.\n" + . "See: %s", + $tokenPosition, + $functionCall, + [ + $this->getOldFunctionCall($functionCall), + $this->getNewFunctionCall($functionCall), + $this->getDocsUrl($functionCall), + ] + ); + } + + /** + * Provide all function names that are deprecated and should be handled by + * the Sniff. + * + * @return array + */ protected function getFunctionNames() { return array_keys($this->deprecatedFunctions); } + /** + * The original function call, to allow user to check matches. + * + * As we match the function name, that can be provided by multiple classes, + * you should provide an example, so users can check that this is the + * legacy one. + * + * @return string + */ protected function getOldFunctionCall($functionName) { return $this->deprecatedFunctions[$functionName]['oldFunctionCall']; } + /** + * The new function call, or information how to migrate. + * + * To provide feedback for user to ease migration. + * + * @return string + */ protected function getNewFunctionCall($functionName) { $newCall = $this->deprecatedFunctions[$functionName]['newFunctionCall']; @@ -53,6 +155,11 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff extends AbstractFun return 'There is no replacement, just remove call'; } + /** + * Allow user to lookup the official docs related to this deprecation / breaking change. + * + * @return string + */ protected function getDocsUrl($functionName) { return $this->deprecatedFunctions[$functionName]['docsUrl']; From 0ee10ea61fe218d02d7df8a269f3d49fbf89d106 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 11:44:06 +0200 Subject: [PATCH 04/16] BUGFIX: Allow deprecations to work in vim too. * Remove line breaks from output, as syntastic will not parse them. * It's up to the report to format the messages, not the Sniff. Relates: #33 --- .../Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php | 6 +++--- .../Sniffs/Deprecated/GenericFunctionCallSniff.php | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php index 73a2061..603ea88 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php @@ -81,9 +81,9 @@ class Typo3Update_Sniffs_Deprecated_AjaxRegistrationSniff implements PhpCsSniff } $phpcsFile->addWarning( - "Defining AJAX using %s is no longer supported with a single String like %s.\n" - . "Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests.\n" - . 'See: %s', + 'Defining AJAX using %s is no longer supported with a single String like %s.' + . ' Since TYPO3 7.6, use PSR-7-based Routing for Backend AJAX Requests.' + . ' See: %s', $tokenToCheck, '', [ diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index d6cd39a..9dac445 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -101,9 +101,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni $functionCall = $token['content']; $phpcsFile->addWarning( - "Legacy function calls are not allowed; found %s.\n" - . "%s.\n" - . "See: %s", + 'Legacy function calls are not allowed; found %s. %s. See: %s', $tokenPosition, $functionCall, [ From cd434ac6398d3e256dc3fee0e17c931ec158adc4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 12:52:14 +0200 Subject: [PATCH 05/16] WIP|FEATURE: Provide configuration files for deprecated functions * To provide a way to adjust deprecations without touching standard. * Provide an option defining the path to lookup the configuration files. * Parse yaml files containing deprecations. Relates: #33 --- composer.json | 3 +- .../Deprecated/Functions/7.0.yaml | 114 ++++++++++++++++++ .../Deprecated/GenericFunctionCallSniff.php | 40 ++++-- .../Typo3Update/Sniffs/OptionsAccessTrait.php | 17 +++ 4 files changed, 162 insertions(+), 12 deletions(-) create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml diff --git a/composer.json b/composer.json index 4f488fb..2a3c23e 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ } }, "require": { - "squizlabs/php_codesniffer": "2.8.*" + "squizlabs/php_codesniffer": "2.8.*", + "symfony/yaml": "3.2.*" }, "license": "GPL-2.0+", "authors": [ diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml new file mode 100644 index 0000000..f01183a --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml @@ -0,0 +1,114 @@ +# Deprecated in 7.0: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Index.html#breaking-changes +loadTCA: + oldFunctionCall: '\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html' +getCompressedTCarray: + oldFunctionCall: '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getCompressedTCarray()' + newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' +includeTCA: + oldFunctionCall: '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::includeTCA()' + newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' +mail: + oldFunctionCall: 'MailUtility::mail()' + newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' +plainMailEncoded: + oldFunctionCall: 'GeneralUtility::plainMailEncoded()' + newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' +connectDB: + oldFunctionCall: '\TYPO3\CMS\Frontend\Utility\EidUtility::connectDB()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61863-ConnectDbFunctionRemoved.html' +int_from_ver: + oldFunctionCall: '\TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver' + newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' +getUniqueFields: + oldFunctionCall: '\TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields()' + newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' +isSafeModeEnabled: + oldFunctionCall: '\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSafeModeEnabled()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +isMagicQuotesGpcEnabled: + oldFunctionCall: '\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isMagicQuotesGpcEnabled()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +isLocalconfWritable: + oldFunctionCall: '\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLocalconfWritable' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' +create: + oldFunctionCall: 'ObjectManager::create()' + newFunctionCall: 'Use ObjectManager::get() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# TODO: Find a way to make same method name in different classes work. +# create: +# oldFunctionCall: 'ObjectManagerInterface::create()' +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +replaceObject: + oldFunctionCall: 'PersistenceGenericBackend::replaceObject()' + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +setReturnRawQueryResult: + oldFunctionCall: 'QuerySettingsInterface::setReturnRawQueryResult()' + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +getReturnRawQueryResult: + oldFunctionCall: 'QuerySettingsInterface::getReturnRawQueryResult()' + newFunctionCall: 'Use the parameter on $query->execute() directly' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +setSysLanguageUid: + oldFunctionCall: 'Typo3QuerySettings::setSysLanguageUid()' + newFunctionCall: 'Use setLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +getSysLanguageUid: + oldFunctionCall: 'Typo3QuerySettings::getSysLanguageUid()' + newFunctionCall: 'Use getLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +JScharCode: + oldFunctionCall: 'LanguageService::JScharCode()' + newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +joinTSarrays: + oldFunctionCall: 'ContentObjectRenderer::joinTSarrays()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +tidyHTML: + oldFunctionCall: 'TypoScriptFrontendController::tidyHTML()' + newFunctionCall: 'You may use the tidy extension from TER' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +isWebFolder: + oldFunctionCall: 'ElementBrowser::isWebFolder()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +checkFolder: + oldFunctionCall: 'ElementBrowser::checkFolder()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +getTreeObject: + oldFunctionCall: 'AbstractDatabaseRecordList::getTreeObject()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +dirData: + oldFunctionCall: 'FileList::dirData()' + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +stdWrapValue: + oldFunctionCall: 'FilesContentObject::stdWrapValue()' + newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +userTempFolder: + oldFunctionCall: 'ImportExportController::userTempFolder()' + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +userSaveFolder: + oldFunctionCall: 'ImportExportController::userSaveFolder()' + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index 9dac445..ff02b8d 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -22,6 +22,7 @@ use PHP_CodeSniffer_File as PhpCsFile; use PHP_CodeSniffer_Sniff as PhpCsSniff; use PHP_CodeSniffer_Tokens as Tokens; +use Symfony\Component\Yaml\Yaml; /** * Sniff that handles all calls to deprecated functions. @@ -31,21 +32,31 @@ use PHP_CodeSniffer_Tokens as Tokens; class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSniff { use \Typo3Update\Sniffs\ExtendedPhpCsSupportTrait; + use \Typo3Update\Sniffs\OptionsAccessTrait; /** * Configuration to define deprecated functions. * * Keys have to match the function name. * + * TODO: Multiple files allowed, using glob ... to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... + * TODO: Build necessary structure from that files, to make it more independent ... ?! + * * @var array */ - protected $deprecatedFunctions = [ - 'loadTCA' => [ - 'oldFunctionCall' => '\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA()', - 'newFunctionCall' => null, - 'docsUrl' => 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html', - ], - ]; + protected static $deprecatedFunctions = []; + + public function __construct() + { + if (static::$deprecatedFunctions === []) { + foreach ($this->getDeprecatedFunctionConfigFiles() as $file) { + static::$deprecatedFunctions = array_merge( + static::$deprecatedFunctions, + Yaml::parse(file_get_contents((string) $file)) + ); + } + } + } /** * Returns the token types that this sniff is interested in. @@ -83,6 +94,13 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni return; } + // TODO: Check if function is static and whether last class name part matches. + // TODO: Add new property to array "last class name part" and use for check if exists. + // TODO: How to handle methods? They are not static, are behind a variable or something else ... + + // E.g.: getUniqueFields + // E.g.: mail + $this->addWarning($phpcsFile, $stackPtr); } @@ -120,7 +138,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getFunctionNames() { - return array_keys($this->deprecatedFunctions); + return array_keys(static::$deprecatedFunctions); } /** @@ -134,7 +152,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getOldFunctionCall($functionName) { - return $this->deprecatedFunctions[$functionName]['oldFunctionCall']; + return static::$deprecatedFunctions[$functionName]['oldFunctionCall']; } /** @@ -146,7 +164,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getNewFunctionCall($functionName) { - $newCall = $this->deprecatedFunctions[$functionName]['newFunctionCall']; + $newCall = static::$deprecatedFunctions[$functionName]['newFunctionCall']; if ($newCall !== null) { return $newCall; } @@ -160,6 +178,6 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getDocsUrl($functionName) { - return $this->deprecatedFunctions[$functionName]['docsUrl']; + return static::$deprecatedFunctions[$functionName]['docsUrl']; } } diff --git a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php index 7193e07..93c6745 100644 --- a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php +++ b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php @@ -54,4 +54,21 @@ trait OptionsAccessTrait } return $mappingFile; } + + /** + * Returns an array of absolute file names containing deprecation function configurations. + * + * @return \Generator + */ + public function getDeprecatedFunctionConfigFiles() + { + $configFiles = PhpCs::getConfigData('deprecatedfunctionConfigFiles'); + if (!$configFiles) { + $configFiles = __DIR__ . '/../Configuration/Deprecated/Functions/*.yaml'; + } + + foreach ((new \GlobIterator($configFiles)) as $file) { + yield (string) $file; + } + } } From b652137e96a7231c2d1e1c2e0c5d0db70f6b393c Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 15:29:26 +0200 Subject: [PATCH 06/16] FEATURE: Provide code to handle deprecated method calls * Add parsing of YAML-files. * Check matching deprecated calls. * Provide necessary information for PHPCS and user. Relates: #33 --- .../Deprecated/Functions/7.0.yaml | 169 ++++++++--------- .../Deprecated/GenericFunctionCallSniff.php | 170 ++++++++++++++---- 2 files changed, 205 insertions(+), 134 deletions(-) diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml index f01183a..4a56a00 100644 --- a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml @@ -1,114 +1,85 @@ # Deprecated in 7.0: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Index.html#breaking-changes -loadTCA: - oldFunctionCall: '\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA()' +\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA: newFunctionCall: null docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html' -getCompressedTCarray: - oldFunctionCall: '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getCompressedTCarray()' +\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getCompressedTCarray: newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' -includeTCA: - oldFunctionCall: '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::includeTCA()' +\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->includeTCA: newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' -mail: - oldFunctionCall: 'MailUtility::mail()' +\TYPO3\CMS\Core\Utility\MailUtility::mail: newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' -plainMailEncoded: - oldFunctionCall: 'GeneralUtility::plainMailEncoded()' +\TYPO3\CMS\Core\Utility\GeneralUtility::plainMailEncoded: newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' -connectDB: - oldFunctionCall: '\TYPO3\CMS\Frontend\Utility\EidUtility::connectDB()' +\TYPO3\CMS\Frontend\Utility\EidUtility::connectDB: newFunctionCall: null docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61863-ConnectDbFunctionRemoved.html' -int_from_ver: - oldFunctionCall: '\TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver' - newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' -getUniqueFields: - oldFunctionCall: '\TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields()' - newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' -isSafeModeEnabled: - oldFunctionCall: '\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSafeModeEnabled()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -isMagicQuotesGpcEnabled: - oldFunctionCall: '\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isMagicQuotesGpcEnabled()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -isLocalconfWritable: - oldFunctionCall: '\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLocalconfWritable' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' -create: - oldFunctionCall: 'ObjectManager::create()' - newFunctionCall: 'Use ObjectManager::get() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# TODO: Find a way to make same method name in different classes work. -# create: -# oldFunctionCall: 'ObjectManagerInterface::create()' +# int_from_ver: +# newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' +# getUniqueFields: +# newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' +# isSafeModeEnabled: # newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +# isMagicQuotesGpcEnabled: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +# isLocalconfWritable: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' +# create: +# newFunctionCall: 'Use ObjectManager::get() instead' # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -replaceObject: - oldFunctionCall: 'PersistenceGenericBackend::replaceObject()' - newFunctionCall: 'Removed without replacement' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -setReturnRawQueryResult: - oldFunctionCall: 'QuerySettingsInterface::setReturnRawQueryResult()' - newFunctionCall: 'Removed without replacement' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -getReturnRawQueryResult: - oldFunctionCall: 'QuerySettingsInterface::getReturnRawQueryResult()' - newFunctionCall: 'Use the parameter on $query->execute() directly' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -setSysLanguageUid: - oldFunctionCall: 'Typo3QuerySettings::setSysLanguageUid()' - newFunctionCall: 'Use setLanguageUid() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -getSysLanguageUid: - oldFunctionCall: 'Typo3QuerySettings::getSysLanguageUid()' - newFunctionCall: 'Use getLanguageUid() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -JScharCode: - oldFunctionCall: 'LanguageService::JScharCode()' - newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -joinTSarrays: - oldFunctionCall: 'ContentObjectRenderer::joinTSarrays()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -tidyHTML: - oldFunctionCall: 'TypoScriptFrontendController::tidyHTML()' - newFunctionCall: 'You may use the tidy extension from TER' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -isWebFolder: - oldFunctionCall: 'ElementBrowser::isWebFolder()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -checkFolder: - oldFunctionCall: 'ElementBrowser::checkFolder()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -getTreeObject: - oldFunctionCall: 'AbstractDatabaseRecordList::getTreeObject()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -dirData: - oldFunctionCall: 'FileList::dirData()' - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -stdWrapValue: - oldFunctionCall: 'FilesContentObject::stdWrapValue()' - newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -userTempFolder: - oldFunctionCall: 'ImportExportController::userTempFolder()' - newFunctionCall: 'Use getDefaultImportExportFolder instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -userSaveFolder: - oldFunctionCall: 'ImportExportController::userSaveFolder()' - newFunctionCall: 'Use getDefaultImportExportFolder instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# # create: +# # newFunctionCall: null +# # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# replaceObject: +# newFunctionCall: 'Removed without replacement' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# setReturnRawQueryResult: +# newFunctionCall: 'Removed without replacement' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# getReturnRawQueryResult: +# newFunctionCall: 'Use the parameter on $query->execute() directly' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# setSysLanguageUid: +# newFunctionCall: 'Use setLanguageUid() instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# getSysLanguageUid: +# newFunctionCall: 'Use getLanguageUid() instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +# JScharCode: +# newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# joinTSarrays: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# tidyHTML: +# newFunctionCall: 'You may use the tidy extension from TER' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# isWebFolder: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# checkFolder: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# getTreeObject: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# dirData: +# newFunctionCall: null +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# stdWrapValue: +# newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# userTempFolder: +# newFunctionCall: 'Use getDefaultImportExportFolder instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +# userSaveFolder: +# newFunctionCall: 'Use getDefaultImportExportFolder instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index ff02b8d..895332f 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -37,27 +37,59 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni /** * Configuration to define deprecated functions. * - * Keys have to match the function name. - * - * TODO: Multiple files allowed, using glob ... to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... - * TODO: Build necessary structure from that files, to make it more independent ... ?! - * * @var array */ protected static $deprecatedFunctions = []; + /** + * Function for the current sniff instance. + * @var array + */ + private $deprecatedFunction = []; + + /** + * TODO: Multiple files allowed, using glob ... to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... + */ public function __construct() { if (static::$deprecatedFunctions === []) { foreach ($this->getDeprecatedFunctionConfigFiles() as $file) { static::$deprecatedFunctions = array_merge( static::$deprecatedFunctions, - Yaml::parse(file_get_contents((string) $file)) + $this->prepareStructure(Yaml::parse(file_get_contents((string) $file))) ); } } } + /** + * Prepares structure from config for later usage. + * + * @param array $deprecatedFunctions + * @return array + */ + protected function prepareStructure(array $deprecatedFunctions) + { + array_walk($deprecatedFunctions, function (&$config, $function) { + // Split static methods and methods. + $split = preg_split('/::|->/', $function); + + $config['static'] = strpos($function, '::') !== false; + $config['fqcn'] = null; + $config['class'] = null; + $config['function'] = $split[0]; + + // If split contains two parts, it's a class with method + if (isset($split[1])) { + $config['fqcn'] = $split[0]; + $config['class'] = array_slice(explode('\\', $config['fqcn']), -1)[0]; + $config['function'] = $split[1]; + } + }); + + return $deprecatedFunctions; + } + /** * Returns the token types that this sniff is interested in. * @@ -83,25 +115,92 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ public function process(PhpCsFile $phpcsFile, $stackPtr) { - if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { + if (!$this->isFunctionCallDeprecated($phpcsFile, $stackPtr)) { return; } + $this->addWarning($phpcsFile, $stackPtr); + } + + /** + * Check whether function at given point is deprecated. + * + * @return bool + */ + protected function isFunctionCallDeprecated(PhpCsFile $phpcsFile, $stackPtr) + { + if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { + return false; + } + $tokens = $phpcsFile->getTokens(); - $token = $tokens[$stackPtr]; + $staticPosition = $phpcsFile->findPrevious(T_WHITESPACE, $stackPtr - 1, null, true, null, true); - if (in_array($token['content'], $this->getFunctionNames()) === false) { - return; + $functionName = $tokens[$stackPtr]['content']; + $isStatic = false; + $class = false; + + if ($staticPosition !== false) { + $isStatic = $tokens[$staticPosition]['code'] === T_DOUBLE_COLON; } - // TODO: Check if function is static and whether last class name part matches. - // TODO: Add new property to array "last class name part" and use for check if exists. - // TODO: How to handle methods? They are not static, are behind a variable or something else ... + if ($isStatic) { + $class = $phpcsFile->findPrevious(T_STRING, $staticPosition, null, false, null, true); + if ($class !== false) { + $class = $tokens[$class]['content']; + } + } - // E.g.: getUniqueFields - // E.g.: mail + return $this->getDeprecatedFunction($functionName, $class, $isStatic) !== []; + } - $this->addWarning($phpcsFile, $stackPtr); + /** + * Returns all matching deprecated functions for given arguments. + * + * Also prepares functions for later usages in $this->deprecatedFunction. + * + * @param string $functionName + * @param string $className The last part of the class name, splitted by namespaces. + * @param bool $isStatic + * + * @return array + */ + protected function getDeprecatedFunction($functionName, $className, $isStatic) + { + // We will not match any static method, without the class name, at least for now. + // Otherwise we could handle them the same way as instance methods. + if ($isStatic === true && $className === false) { + return []; + } + + $this->deprecatedFunction = array_filter( + static::$deprecatedFunctions, + function ($config) use ($functionName, $isStatic, $className) { + return $functionName === $config['function'] + && $isStatic === $config['static'] + && ( + $className === $config['class'] + || $className === false + ) // TODO: If no class, it's also fine, vor variable, non static methods. + ; + } + ); + + return $this->deprecatedFunction; + } + + /** + * Returns configuration for currently checked function. + * + * @return array + */ + protected function getCurrentDeprecatedFunction() + { + $config = current($this->deprecatedFunction); + + // TODO: Add exception if something went wrong? + + return $config; } /** @@ -114,31 +213,27 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) { - $tokens = $phpcsFile->getTokens(); - $token = $tokens[$tokenPosition]; - $functionCall = $token['content']; - $phpcsFile->addWarning( 'Legacy function calls are not allowed; found %s. %s. See: %s', $tokenPosition, - $functionCall, + $this->getFunctionIdentifier(), [ - $this->getOldFunctionCall($functionCall), - $this->getNewFunctionCall($functionCall), - $this->getDocsUrl($functionCall), + $this->getOldfunctionCall(), + $this->getNewFunctionCall(), + $this->getDocsUrl(), ] ); } /** - * Provide all function names that are deprecated and should be handled by - * the Sniff. + * Identifier for configuring this specific error / warning through PHPCS. * - * @return array + * @return string */ - protected function getFunctionNames() + protected function getFunctionIdentifier() { - return array_keys(static::$deprecatedFunctions); + $config = $this->getCurrentDeprecatedFunction(); + return $config['class'] . '.' . $config['function']; } /** @@ -150,9 +245,14 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * * @return string */ - protected function getOldFunctionCall($functionName) + protected function getOldFunctionCall() { - return static::$deprecatedFunctions[$functionName]['oldFunctionCall']; + $config = $this->getCurrentDeprecatedFunction(); + $concat = '->'; + if ($config['static']) { + $concat = '::'; + } + return $config['fqcn'] . $concat . $config['function']; } /** @@ -162,9 +262,9 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * * @return string */ - protected function getNewFunctionCall($functionName) + protected function getNewFunctionCall() { - $newCall = static::$deprecatedFunctions[$functionName]['newFunctionCall']; + $newCall = $this->getCurrentDeprecatedFunction()['newFunctionCall']; if ($newCall !== null) { return $newCall; } @@ -176,8 +276,8 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * * @return string */ - protected function getDocsUrl($functionName) + protected function getDocsUrl() { - return static::$deprecatedFunctions[$functionName]['docsUrl']; + return $this->getCurrentDeprecatedFunction()['docsUrl']; } } From 81fc7f7608e00547cee88d16a4221bb792205606 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 28 Mar 2017 16:41:15 +0200 Subject: [PATCH 07/16] WIP|FEATURE: Add further deprecated calls * Configure further deprecated calls for TYPO3 7.0 * Remove todo as it's already done. Relates: #33 --- .../Deprecated/Functions/7.0.yaml | 217 ++++++++++++------ .../Deprecated/GenericFunctionCallSniff.php | 2 +- 2 files changed, 152 insertions(+), 67 deletions(-) diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml index 4a56a00..0cd9429 100644 --- a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml @@ -17,69 +17,154 @@ \TYPO3\CMS\Frontend\Utility\EidUtility::connectDB: newFunctionCall: null docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61863-ConnectDbFunctionRemoved.html' -# int_from_ver: -# newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' -# getUniqueFields: -# newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' -# isSafeModeEnabled: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -# isMagicQuotesGpcEnabled: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -# isLocalconfWritable: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' -# create: -# newFunctionCall: 'Use ObjectManager::get() instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# # create: -# # newFunctionCall: null -# # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# replaceObject: -# newFunctionCall: 'Removed without replacement' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# setReturnRawQueryResult: -# newFunctionCall: 'Removed without replacement' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# getReturnRawQueryResult: -# newFunctionCall: 'Use the parameter on $query->execute() directly' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# setSysLanguageUid: -# newFunctionCall: 'Use setLanguageUid() instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# getSysLanguageUid: -# newFunctionCall: 'Use getLanguageUid() instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -# JScharCode: -# newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# joinTSarrays: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# tidyHTML: -# newFunctionCall: 'You may use the tidy extension from TER' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# isWebFolder: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# checkFolder: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# getTreeObject: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# dirData: -# newFunctionCall: null -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# stdWrapValue: -# newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# userTempFolder: -# newFunctionCall: 'Use getDefaultImportExportFolder instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -# userSaveFolder: -# newFunctionCall: 'Use getDefaultImportExportFolder instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver: + newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' +\TYPO3\CMS\Core\DataHandlin\DataHandler->getUniqueFields: + newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' +\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSafeModeEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isMagicQuotesGpcEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLocalconfWritable: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' +\TYPO3\CMS\Extbase\Object\ObjectManager->create: + newFunctionCall: 'Use ObjectManager::get() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Extbase\Persistence\Generic\Backend->replaceObject: + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->setReturnRawQueryResult: + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->getReturnRawQueryResult: + newFunctionCall: 'Use the parameter on $query->execute() directly' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->setSysLanguageUid: + newFunctionCall: 'Use setLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->getSysLanguageUid: + newFunctionCall: 'Use getLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' +\TYPO3\CMS\Lang\LanguageService->JScharCode: + newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Frontend\ContentObjec\ContentObjectRenderer->joinTSarrays: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->tidyHTML: + newFunctionCall: 'You may use the tidy extension from TER' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Recordlist\Browser\ElementBrowser->isWebFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Recordlist\Browser\ElementBrowser->checkFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList->getTreeObject: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Filelist\FileList->dirData: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Frontend\ContentObject\FilesContentObject->stdWrapValue: + newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Impexp\Controller\ImportExportController->userTempFolder: + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Impexp\Controller\ImportExportController->userSaveFolder: + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->func_filesearch: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->findFile: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->buildStyleSheet: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->loremIpsumInsert: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Workspaces\Service\StagesService->checkCustomStagingForWS: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' +\TYPO3\CMS\Core\DataHandling\DataHandler->clear_cache: + newFunctionCall: 'Use ->clear_cacheCmd() instead. Alternatively you can call ->registerPageCacheClearing() from a hook to not immediately clear the cache but register clearing after DataHandler operation finishes' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\DataHandling\DataHandler->internal_clearPageCache: + newFunctionCall: 'Use the cache manager directly' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule: + newFunctionCall: 'Use ArrayUtility::mergeRecursiveWithOverrule() instead. WARNING: The new method changed its signature and does not return the first parameter anymore' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\GeneralUtility::htmlspecialchars_decode: + newFunctionCall: 'Use native PHP htmlspecialchars_decode() function' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +# TODO: This is useless, adding a warning to all "get" methods is crazy. +# \TYPO3\CMS\Core\Category\CategoryRegistry->get: +# newFunctionCall: 'Use isRegistered() instead' +# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Category\CategoryRegistry->applyTca: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->findByUid: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->addToIndex: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecordsForFolder: + newFunctionCall: 'Use FileIndexRepository::findByFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecord: + newFunctionCall: 'Use FileIndexRepository::findOneByFileObject() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->findBySha1Hash: + newFunctionCall: 'Use FileIndexRepository::findByContentHash() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\FileRepository->update: + newFunctionCall: 'Use FileIndexRepository::update() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\ResourceStorage->getFolderByIdentifier: + newFunctionCall: 'Use getFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\ResourceStorage->getFileByIdentifier: + newFunctionCall: 'Use getFileInfoByIdentifier() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\ResourceStorage->getFileList: + newFunctionCall: 'Use getFilesInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\ResourceStorage->getFolderList: + newFunctionCall: 'Use getFoldersInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Resource\ResourceStorage->fetchFolderListFromDriver: + newFunctionCall: 'Use getFoldersInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->getTotalFileInfo: + newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->checkFileNameLen: + newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->isPathValid: + newFunctionCall: 'Use GeneralUtility::validPathStr() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->blindPath: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->findTempFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->rmDoubleSlash: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\BasicFileUtility->cleanDirectoryName: + newFunctionCall: 'Use PathUtility::getCanonicalPath() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index 895332f..a4c7330 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -181,7 +181,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni && ( $className === $config['class'] || $className === false - ) // TODO: If no class, it's also fine, vor variable, non static methods. + ) ; } ); From 4c162af3d49987cf6a9a6dde66fb8d6fdcd18fff Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 Mar 2017 08:08:41 +0200 Subject: [PATCH 08/16] TASK: Finish 7.0 breaking changes --- .../Deprecated/Functions/7.0.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml index 0cd9429..05105d1 100644 --- a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml @@ -108,6 +108,7 @@ newFunctionCall: 'Use native PHP htmlspecialchars_decode() function' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' # TODO: This is useless, adding a warning to all "get" methods is crazy. +# Also this is already handeled by: Typo3Update_Sniffs_LegacyClassnames_InstantiationWithObjectManagerSniff # \TYPO3\CMS\Core\Category\CategoryRegistry->get: # newFunctionCall: 'Use isRegistered() instead' # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' @@ -168,3 +169,45 @@ \TYPO3\CMS\Core\Utility\File\BasicFileUtility->cleanDirectoryName: newFunctionCall: 'Use PathUtility::getCanonicalPath() instead' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->init_actionPerms: + newFunctionCall: 'Use setActionPermissions() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->printLogErrorMessages: + newFunctionCall: 'Use pushErrorMessagesToFlashMessageQueue() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->findRecycler: + newFunctionCall: 'Use \TYPO3\CMS\Core\Resource\ResourceStorage instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Html\RteHtmlParser->findRecycler: + newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Rtehtmlarea\SelectImage->getRTEImageStorageDir: + newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Localization\Locales->getTerLocales: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Localization\Locales->getTerLocaleDependencies: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Localization\Locales->convertToTerLocales: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getInsertionNeedles: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getRequiredExtensionListArray: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::writeNewExtensionList: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSqlSafeModeEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +\TYPO3\CMS\Core\Core\ClassLoader::getAliasForClassName: + newFunctionCall: 'Use getAliasesForClassName() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' From 21b7c09416f35ce89e320d98aa77a85f21a570b2 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 Mar 2017 11:03:30 +0200 Subject: [PATCH 09/16] FEATURE: Add removed functions for TYPO3 7.x. * Adjust structure of deprecated functions yaml. * Add version of removal to message for removed functions. Relates: #33 --- .../Deprecated/Functions/7.0.yaml | 431 +++++++++--------- .../Deprecated/Functions/7.1.yaml | 4 + .../Deprecated/Functions/7.2.yaml | 36 ++ .../Deprecated/Functions/7.3.yaml | 13 + .../Deprecated/Functions/7.4.yaml | 81 ++++ .../Deprecated/Functions/7.5.yaml | 2 + .../Deprecated/GenericFunctionCallSniff.php | 58 ++- 7 files changed, 395 insertions(+), 230 deletions(-) create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml index 05105d1..3913b8c 100644 --- a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml @@ -1,213 +1,218 @@ -# Deprecated in 7.0: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Index.html#breaking-changes -\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html' -\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getCompressedTCarray: - newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' -\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->includeTCA: - newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' -\TYPO3\CMS\Core\Utility\MailUtility::mail: - newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' -\TYPO3\CMS\Core\Utility\GeneralUtility::plainMailEncoded: - newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' -\TYPO3\CMS\Frontend\Utility\EidUtility::connectDB: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61863-ConnectDbFunctionRemoved.html' -\TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver: - newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' -\TYPO3\CMS\Core\DataHandlin\DataHandler->getUniqueFields: - newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' -\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSafeModeEnabled: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isMagicQuotesGpcEnabled: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLocalconfWritable: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' -\TYPO3\CMS\Extbase\Object\ObjectManager->create: - newFunctionCall: 'Use ObjectManager::get() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Extbase\Persistence\Generic\Backend->replaceObject: - newFunctionCall: 'Removed without replacement' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->setReturnRawQueryResult: - newFunctionCall: 'Removed without replacement' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->getReturnRawQueryResult: - newFunctionCall: 'Use the parameter on $query->execute() directly' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->setSysLanguageUid: - newFunctionCall: 'Use setLanguageUid() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->getSysLanguageUid: - newFunctionCall: 'Use getLanguageUid() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' -\TYPO3\CMS\Lang\LanguageService->JScharCode: - newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Frontend\ContentObjec\ContentObjectRenderer->joinTSarrays: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->tidyHTML: - newFunctionCall: 'You may use the tidy extension from TER' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Recordlist\Browser\ElementBrowser->isWebFolder: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Recordlist\Browser\ElementBrowser->checkFolder: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList->getTreeObject: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Filelist\FileList->dirData: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Frontend\ContentObject\FilesContentObject->stdWrapValue: - newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Impexp\Controller\ImportExportController->userTempFolder: - newFunctionCall: 'Use getDefaultImportExportFolder instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Impexp\Controller\ImportExportController->userSaveFolder: - newFunctionCall: 'Use getDefaultImportExportFolder instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->func_filesearch: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->findFile: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->buildStyleSheet: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->loremIpsumInsert: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Workspaces\Service\StagesService->checkCustomStagingForWS: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' -\TYPO3\CMS\Core\DataHandling\DataHandler->clear_cache: - newFunctionCall: 'Use ->clear_cacheCmd() instead. Alternatively you can call ->registerPageCacheClearing() from a hook to not immediately clear the cache but register clearing after DataHandler operation finishes' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\DataHandling\DataHandler->internal_clearPageCache: - newFunctionCall: 'Use the cache manager directly' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule: - newFunctionCall: 'Use ArrayUtility::mergeRecursiveWithOverrule() instead. WARNING: The new method changed its signature and does not return the first parameter anymore' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\GeneralUtility::htmlspecialchars_decode: - newFunctionCall: 'Use native PHP htmlspecialchars_decode() function' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -# TODO: This is useless, adding a warning to all "get" methods is crazy. -# Also this is already handeled by: Typo3Update_Sniffs_LegacyClassnames_InstantiationWithObjectManagerSniff -# \TYPO3\CMS\Core\Category\CategoryRegistry->get: -# newFunctionCall: 'Use isRegistered() instead' -# docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Category\CategoryRegistry->applyTca: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->findByUid: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->addToIndex: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecordsForFolder: - newFunctionCall: 'Use FileIndexRepository::findByFolder() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecord: - newFunctionCall: 'Use FileIndexRepository::findOneByFileObject() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->findBySha1Hash: - newFunctionCall: 'Use FileIndexRepository::findByContentHash() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\FileRepository->update: - newFunctionCall: 'Use FileIndexRepository::update() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\ResourceStorage->getFolderByIdentifier: - newFunctionCall: 'Use getFolder() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\ResourceStorage->getFileByIdentifier: - newFunctionCall: 'Use getFileInfoByIdentifier() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\ResourceStorage->getFileList: - newFunctionCall: 'Use getFilesInFolder() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\ResourceStorage->getFolderList: - newFunctionCall: 'Use getFoldersInFolder() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Resource\ResourceStorage->fetchFolderListFromDriver: - newFunctionCall: 'Use getFoldersInFolder() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->getTotalFileInfo: - newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->checkFileNameLen: - newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->isPathValid: - newFunctionCall: 'Use GeneralUtility::validPathStr() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->blindPath: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->findTempFolder: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->rmDoubleSlash: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\BasicFileUtility->cleanDirectoryName: - newFunctionCall: 'Use PathUtility::getCanonicalPath() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->init_actionPerms: - newFunctionCall: 'Use setActionPermissions() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->printLogErrorMessages: - newFunctionCall: 'Use pushErrorMessagesToFlashMessageQueue() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->findRecycler: - newFunctionCall: 'Use \TYPO3\CMS\Core\Resource\ResourceStorage instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Html\RteHtmlParser->findRecycler: - newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Rtehtmlarea\SelectImage->getRTEImageStorageDir: - newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Localization\Locales->getTerLocales: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Localization\Locales->getTerLocaleDependencies: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Localization\Locales->convertToTerLocales: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getInsertionNeedles: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getRequiredExtensionListArray: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::writeNewExtensionList: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSqlSafeModeEnabled: - newFunctionCall: null - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' -\TYPO3\CMS\Core\Core\ClassLoader::getAliasForClassName: - newFunctionCall: 'Use getAliasesForClassName() instead' - docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' +# Breaking changes in 7.0: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Index.html#breaking-changes +'7.0': + \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-LoadTcaFunctionRemoved.html' + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->getCompressedTCarray: + newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->includeTCA: + newFunctionCall: 'Full TCA is always loaded during bootstrap in FE, the method is obsolete. If an eid script calls this method to load TCA, use \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61785-FrontendTcaFunctionsRemoved.html' + \TYPO3\CMS\Core\Utility\MailUtility::mail: + newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' + \TYPO3\CMS\Core\Utility\GeneralUtility::plainMailEncoded: + newFunctionCall: 'Use the \TYPO3\CMS\Core\Mail\Mailer API for sending email' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61783-RemoveDeprecatedMailFunctionality.html' + \TYPO3\CMS\Frontend\Utility\EidUtility::connectDB: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61863-ConnectDbFunctionRemoved.html' + \TYPO3\CMS\Core\Utility\GeneralUtility::int_from_ver: + newFunctionCall: 'Replace the usage of the removed function with \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61860-RemoveIntFromVerFunction.html' + \TYPO3\CMS\Core\DataHandlin\DataHandler->getUniqueFields: + newFunctionCall: 'Replace all calls to \TYPO3\CMS\Core\DataHandling\DataHandler::getUniqueFields() with calls to \TYPO3\CMS\Version\Hook\DataHandlerHook::getUniqueFields()' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61822-GetUniqueFieldsFunctionRemoved.html' + \TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSafeModeEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' + \TYPO3\CMS\Core\Utility\PhpOptionsUtility::isMagicQuotesGpcEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61820-PhpOptionsUtilityDeprecatedFunctionsRemoved.html' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLocalconfWritable: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-61802-IsLocalconfWritableFunctionRemoved.html' + \TYPO3\CMS\Extbase\Object\ObjectManager->create: + newFunctionCall: 'Use ObjectManager::get() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\Backend->replaceObject: + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->setReturnRawQueryResult: + newFunctionCall: 'Removed without replacement' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface->getReturnRawQueryResult: + newFunctionCall: 'Use the parameter on $query->execute() directly' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->setSysLanguageUid: + newFunctionCall: 'Use setLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->getSysLanguageUid: + newFunctionCall: 'Use getLanguageUid() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html' + \TYPO3\CMS\Lang\LanguageService->JScharCode: + newFunctionCall: 'Use GeneralUtility::quoteJSvalue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Frontend\ContentObjec\ContentObjectRenderer->joinTSarrays: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->tidyHTML: + newFunctionCall: 'You may use the tidy extension from TER' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Recordlist\Browser\ElementBrowser->isWebFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Recordlist\Browser\ElementBrowser->checkFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList->getTreeObject: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Filelist\FileList->dirData: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Frontend\ContentObject\FilesContentObject->stdWrapValue: + newFunctionCall: 'Use ContentObjectRenderer::stdWrapValue instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Impexp\Controller\ImportExportController->userTempFolder: + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Impexp\Controller\ImportExportController->userSaveFolder: + newFunctionCall: 'Use getDefaultImportExportFolder instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->func_filesearch: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView->findFile: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->buildStyleSheet: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase->loremIpsumInsert: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Workspaces\Service\StagesService->checkCustomStagingForWS: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html' + \TYPO3\CMS\Core\DataHandling\DataHandler->clear_cache: + newFunctionCall: 'Use ->clear_cacheCmd() instead. Alternatively you can call ->registerPageCacheClearing() from a hook to not immediately clear the cache but register clearing after DataHandler operation finishes' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\DataHandling\DataHandler->internal_clearPageCache: + newFunctionCall: 'Use the cache manager directly' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule: + newFunctionCall: 'Use ArrayUtility::mergeRecursiveWithOverrule() instead. WARNING: The new method changed its signature and does not return the first parameter anymore' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\GeneralUtility::htmlspecialchars_decode: + newFunctionCall: 'Use native PHP htmlspecialchars_decode() function' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + # NOTE: This is useless, adding a warning to all "get" methods is crazy. + # Also this is already handeled by: Typo3Update_Sniffs_LegacyClassnames_InstantiationWithObjectManagerSniff + # \TYPO3\CMS\Core\Category\CategoryRegistry->get: + # newFunctionCall: 'Use isRegistered() instead' + # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Category\CategoryRegistry->applyTca: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + # NOTE: This is useless, adding a warning to all "findByUid" methods is crazy. + # Many calls to repositories will be marked as warning + # \TYPO3\CMS\Core\Resource\FileRepository->findByUid: + # newFunctionCall: null + # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\FileRepository->addToIndex: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecordsForFolder: + newFunctionCall: 'Use FileIndexRepository::findByFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\FileRepository->getFileIndexRecord: + newFunctionCall: 'Use FileIndexRepository::findOneByFileObject() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\FileRepository->findBySha1Hash: + newFunctionCall: 'Use FileIndexRepository::findByContentHash() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + # NOTE: This is useless, adding a warning to all "update" methods is crazy. + # All repository updates will be marked as warning + # \TYPO3\CMS\Core\Resource\FileRepository->update: + # newFunctionCall: 'Use FileIndexRepository::update() instead' + # docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\ResourceStorage->getFolderByIdentifier: + newFunctionCall: 'Use getFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\ResourceStorage->getFileByIdentifier: + newFunctionCall: 'Use getFileInfoByIdentifier() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\ResourceStorage->getFileList: + newFunctionCall: 'Use getFilesInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\ResourceStorage->getFolderList: + newFunctionCall: 'Use getFoldersInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Resource\ResourceStorage->fetchFolderListFromDriver: + newFunctionCall: 'Use getFoldersInFolder() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->getTotalFileInfo: + newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->checkFileNameLen: + newFunctionCall: "Use ResourceStorage instead via $GLOBALS['BE_USER']->getFileStorages()" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->isPathValid: + newFunctionCall: 'Use GeneralUtility::validPathStr() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->blindPath: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->findTempFolder: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->rmDoubleSlash: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\BasicFileUtility->cleanDirectoryName: + newFunctionCall: 'Use PathUtility::getCanonicalPath() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->init_actionPerms: + newFunctionCall: 'Use setActionPermissions() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->printLogErrorMessages: + newFunctionCall: 'Use pushErrorMessagesToFlashMessageQueue() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility->findRecycler: + newFunctionCall: 'Use \TYPO3\CMS\Core\Resource\ResourceStorage instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Html\RteHtmlParser->findRecycler: + newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Rtehtmlarea\SelectImage->getRTEImageStorageDir: + newFunctionCall: "Use $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']); instead" + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Localization\Locales->getTerLocales: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Localization\Locales->getTerLocaleDependencies: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Localization\Locales->convertToTerLocales: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getInsertionNeedles: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getRequiredExtensionListArray: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::writeNewExtensionList: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSqlSafeModeEnabled: + newFunctionCall: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' + \TYPO3\CMS\Core\Core\ClassLoader::getAliasForClassName: + newFunctionCall: 'Use getAliasesForClassName() instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html' diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml new file mode 100644 index 0000000..f1184a1 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml @@ -0,0 +1,4 @@ +# Breaking changes in 7.1: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.1/Index.html +# Nothing in here? Right, there were no breaking changes to functions in this version. +# We keep this file to let you know we didn't forget anything. +'7.1': [] diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml new file mode 100644 index 0000000..d1cb239 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml @@ -0,0 +1,36 @@ +# Breaking changes in 7.2: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Index.html +'7.2': + \TYPO3\CMS\Core\Page\PageRenderer->setSvgPath: + newFunctionCall: 'Use 3rd party library instead, which is already loaded by TYPO3' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65962-WebSVGLibraryAndAPIRemoved.html + \TYPO3\CMS\Core\Page\PageRenderer->loadSvg: + newFunctionCall: 'Use 3rd party library instead, which is already loaded by TYPO3' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65962-WebSVGLibraryAndAPIRemoved.html + \TYPO3\CMS\Core\Page\PageRenderer->enableSvgDebug: + newFunctionCall: 'Use 3rd party library instead, which is already loaded by TYPO3' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65962-WebSVGLibraryAndAPIRemoved.html + \TYPO3\CMS\Core\Page\PageRenderer->svgForceFlash: + newFunctionCall: 'Use 3rd party library instead, which is already loaded by TYPO3' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65962-WebSVGLibraryAndAPIRemoved.html + \TYPO3\CMS\Backend\Controller\LoginController->makeLoginForm: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html + \TYPO3\CMS\Backend\Controller\LoginController->makeLogoutForm: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html + \TYPO3\CMS\Backend\Controller\LoginController->wrapLoginForm: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html + \TYPO3\CMS\Backend\Controller\LoginController->makeLoginBoxImage: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html + \TYPO3\CMS\Backend\Controller\LoginController->makeLoginNews: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html + \TYPO3\CMS\Backend\Controller\LoginController->emitRenderLoginFormSignal: + newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html +# NOTE: This is useless, adding a warning to all "getSignalSlotDispatcher" methods is crazy, many developers implement such a method. +# \TYPO3\CMS\Backend\Controller\LoginController->getSignalSlotDispatcher: +# newFunctionCall: 'Use the new Fluid View to adjust the login screen instead' +# docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.2/Breaking-65939-BackendLoginRefactoring.html diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml new file mode 100644 index 0000000..15ff9b8 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml @@ -0,0 +1,13 @@ +# Breaking changes in 7.3: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.3/Index.html#breaking-changes +'7.3': + # NOTE: If this is making you crazy, just disable via ruleset.xml or phpcs.xml + parent::initializeObject: + newFunctionCall: 'Remove call, if this is inside a child of \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject, there is no initializeObject in the parent anymore.' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.3/Breaking-67402-ExtbaseAbstractDomainObjectInitializeObject.html + \TYPO3\CMS\Extbase\Persistence\Repository::replace: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.3/Breaking-63835-RemoveDeprecatedExtbasePersistenceParts.html + \TYPO3\CMS\Extbase\Persistence\Generic\Backend::setDeletedObjects: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.3/Breaking-63835-RemoveDeprecatedExtbasePersistenceParts.html + diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml new file mode 100644 index 0000000..ee9bbd5 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml @@ -0,0 +1,81 @@ +# Breaking changes in 7.4: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Index.html#breaking-changes +'7.4': + \TYPO3\CMS\Core\Page\PageRenderer::setExtCorePath: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68001-RemovedExtJSCoreAndExtJSAdapters.html + \TYPO3\CMS\Core\Page\PageRenderer::getExtCorePath: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68001-RemovedExtJSCoreAndExtJSAdapters.html + \TYPO3\CMS\Core\Page\PageRenderer::loadExtCore: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68001-RemovedExtJSCoreAndExtJSAdapters.html + \TYPO3\CMS\Core\Page\PageRenderer::enableExtCoreDebug: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68001-RemovedExtJSCoreAndExtJSAdapters.html + \TYPO3\CMS\Core\Page\PageRenderer::setExtCorePath: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68001-RemovedExtJSCoreAndExtJSAdapters.html + \TYPO3\CMS\Backend\Controller\EditDocumentController->functionMenus: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67753-DropSecondaryOptions.html + \TYPO3\CMS\Backend\Utility\BackendUtility::getFileIcon: + newFunctionCall: 'Use \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile() insteadenableExtCoreDebug' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67654-RemoveGLOBALSFILEICONSFunctionality.html + \TYPO3\CMS\Frontend\Page\PageGenerator::getIncFiles: + newFunctionCall: 'Use hooks during the Frontend set up to execute custom PHP code' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67646-LibraryInclusionInFrontend.html + \TYPO3\CMS\Backend\Template\DocumentTemplate\DocumentTemplate->formWidthText: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67565-DeprecatedBackendRelatedMethodsRemoved.html + \TYPO3\CMS\Backend\View\PageLayoutView->getBackendLayoutConfiguration: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67565-DeprecatedBackendRelatedMethodsRemoved.html + \TYPO3\CMS\Backend\View\PageLayoutView->wordWrapper: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-67565-DeprecatedBackendRelatedMethodsRemoved.html + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->checkJumpUrlReferer: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-66602-RemoveRefererCheckWhileHandlingJumpUrl.html + \TYPO3\CMS\Core\Utility\OpcodeCacheUtility::initialize: + newFunctionCall: 'Use new service class instead \TYPO3\CMS\Core\Service\OpcodeCacheService' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-63838-ChangedOpcodeCacheUtilityBeingAServiceClass.html + \TYPO3\CMS\Core\Utility\OpcodeCacheUtility::clearAllActive: + newFunctionCall: 'Use new service class instead \TYPO3\CMS\Core\Service\OpcodeCacheService' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-63838-ChangedOpcodeCacheUtilityBeingAServiceClass.html + \TYPO3\CMS\Core\Utility\OpcodeCacheUtility::getAllActive: + newFunctionCall: 'Use new service class instead \TYPO3\CMS\Core\Service\OpcodeCacheService' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-63838-ChangedOpcodeCacheUtilityBeingAServiceClass.html + \TYPO3\CMS\Backend\Tree\View\PagePositionMap->JSimgFunc: + newFunctionCall: 'Use proper styling for a tree list' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-56951-RemoveUnusedMethodsInPagePositionMap.html + \TYPO3\CMS\Backend\Tree\View\PagePositionMap->insertQuadLines: + newFunctionCall: 'Use proper styling for a tree list' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-56951-RemoveUnusedMethodsInPagePositionMap.html + \TYPO3\CMS\Core\Page\PageRenderer->enableExtJSQuickTips: + newFunctionCall: 'Use bootstrap tooltips, which work out of the box as alternative. Simple add data-toggle="tooltip" and data-title="your tooltip" to any element you want' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68276-RemoveExtJSQuicktipsIfPossible.html + \TYPO3\CMS\IndexedSearch\Indexer->removeLoginpagesWithContentHash: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68193-DropRemoveLoginpagesWithContentHashFromIndexerphp.html + \TYPO3\CMS\Frontend\Controller\ExtDirectEidController->actionIsAllowed: + newFunctionCall: 'Migrate your eID scripts to the new PSR-7 compliant model' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68186-AdjustedAndRemovedMethodsInEIDArea.html + # NOTE: It does not make sense to warn about all render methods + # \TYPO3\CMS\Frontend\Controller\ExtDirectEidController->render: + # newFunctionCall: 'Migrate your eID scripts to the new PSR-7 compliant model' + # docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68186-AdjustedAndRemovedMethodsInEIDArea.html + \TYPO3\CMS\Frontend\Utility\EidUtility::isEidRequest: + newFunctionCall: 'Migrate your eID scripts to the new PSR-7 compliant model' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68186-AdjustedAndRemovedMethodsInEIDArea.html + \TYPO3\CMS\Frontend\Utility\EidUtility::getEidScriptPath: + newFunctionCall: 'Migrate your eID scripts to the new PSR-7 compliant model' + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68186-AdjustedAndRemovedMethodsInEIDArea.html + \TYPO3\CMS\Backend\View\PageLayoutView->linkRTEbutton: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68020-DroppedDisableBigButtons.html + \TYPO3\CMS\Backend\View\PageLayoutView->isRTEforField: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68020-DroppedDisableBigButtons.html + \TYPO3\CMS\Backend\View\PageLayoutView->getSpecConfForField: + newFunctionCall: null + docsUrl: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Breaking-68020-DroppedDisableBigButtons.html diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml new file mode 100644 index 0000000..a8e1483 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml @@ -0,0 +1,2 @@ +# Breaking changes in 7.5: https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.5/Index.html#breaking-changes +'7.5': [] diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php index a4c7330..f2f616b 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php @@ -68,26 +68,35 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * @param array $deprecatedFunctions * @return array */ - protected function prepareStructure(array $deprecatedFunctions) + protected function prepareStructure(array $oldStructure) { - array_walk($deprecatedFunctions, function (&$config, $function) { - // Split static methods and methods. - $split = preg_split('/::|->/', $function); + $typo3Versions = array_keys($oldStructure); + $newStructure = []; - $config['static'] = strpos($function, '::') !== false; - $config['fqcn'] = null; - $config['class'] = null; - $config['function'] = $split[0]; + foreach ($typo3Versions as $typo3Version) { + foreach ($oldStructure[$typo3Version] as $function => $config) { + // Split static methods and methods. + $split = preg_split('/::|->/', $function); - // If split contains two parts, it's a class with method - if (isset($split[1])) { - $config['fqcn'] = $split[0]; - $config['class'] = array_slice(explode('\\', $config['fqcn']), -1)[0]; - $config['function'] = $split[1]; - } - }); + $newStructure[$function] = $config; - return $deprecatedFunctions; + $newStructure[$function]['static'] = strpos($function, '::') !== false; + $newStructure[$function]['fqcn'] = null; + $newStructure[$function]['class'] = null; + $newStructure[$function]['function'] = $split[0]; + // TODO: Add a way to check for removed or deprecated. + $newStructure[$function]['version_removed'] = $typo3Version; + + // If split contains two parts, it's a class with method + if (isset($split[1])) { + $newStructure[$function]['fqcn'] = $split[0]; + $newStructure[$function]['class'] = array_slice(explode('\\', $newStructure[$function]['fqcn']), -1)[0]; + $newStructure[$function]['function'] = $split[1]; + } + }; + } + + return $newStructure; } /** @@ -214,11 +223,14 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) { $phpcsFile->addWarning( - 'Legacy function calls are not allowed; found %s. %s. See: %s', + // TODO: Add a way to check for removed or deprecated. + 'Legacy function calls are not allowed; found %s. Removed in %s. %s. See: %s', $tokenPosition, $this->getFunctionIdentifier(), [ $this->getOldfunctionCall(), + // TODO: Add a way to check for removed or deprecated. + $this->getRemovedVersion(), $this->getNewFunctionCall(), $this->getDocsUrl(), ] @@ -255,6 +267,18 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni return $config['fqcn'] . $concat . $config['function']; } + /** + * Returns TYPO3 version when the current function was removed. + * + * To let user decide whether this is important for him. + * + * @return string + */ + protected function getRemovedVersion() + { + return $this->getCurrentDeprecatedFunction()['version_removed']; + } + /** * The new function call, or information how to migrate. * From 93c0cff635bc27ee24a7ca388b92725fa998f9cc Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 Mar 2017 11:08:42 +0200 Subject: [PATCH 10/16] TASK: Rename deprecated to removed for functions * As we check removed functions, the folder and code should reflect that. Relates: #33 --- .../Functions/7.0.yaml | 0 .../Functions/7.1.yaml | 0 .../Functions/7.2.yaml | 0 .../Functions/7.3.yaml | 0 .../Functions/7.4.yaml | 0 .../Functions/7.5.yaml | 0 .../Typo3Update/Sniffs/OptionsAccessTrait.php | 8 +-- .../GenericFunctionCallSniff.php | 59 +++++++++---------- 8 files changed, 32 insertions(+), 35 deletions(-) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.0.yaml (100%) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.1.yaml (100%) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.2.yaml (100%) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.3.yaml (100%) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.4.yaml (100%) rename src/Standards/Typo3Update/Configuration/{Deprecated => Removed}/Functions/7.5.yaml (100%) rename src/Standards/Typo3Update/Sniffs/{Deprecated => Removed}/GenericFunctionCallSniff.php (80%) diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.0.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.0.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.0.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.1.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.1.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.1.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.2.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.2.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.2.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.3.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.3.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.3.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.4.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.4.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.4.yaml diff --git a/src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml b/src/Standards/Typo3Update/Configuration/Removed/Functions/7.5.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Deprecated/Functions/7.5.yaml rename to src/Standards/Typo3Update/Configuration/Removed/Functions/7.5.yaml diff --git a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php index 93c6745..9db7ee7 100644 --- a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php +++ b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php @@ -56,15 +56,15 @@ trait OptionsAccessTrait } /** - * Returns an array of absolute file names containing deprecation function configurations. + * Returns an array of absolute file names containing removed function configurations. * * @return \Generator */ - public function getDeprecatedFunctionConfigFiles() + public function getRemovedFunctionConfigFiles() { - $configFiles = PhpCs::getConfigData('deprecatedfunctionConfigFiles'); + $configFiles = PhpCs::getConfigData('removedfunctionConfigFiles'); if (!$configFiles) { - $configFiles = __DIR__ . '/../Configuration/Deprecated/Functions/*.yaml'; + $configFiles = __DIR__ . '/../Configuration/Removed/Functions/*.yaml'; } foreach ((new \GlobIterator($configFiles)) as $file) { diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php similarity index 80% rename from src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php rename to src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php index f2f616b..2a106de 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php @@ -25,37 +25,37 @@ use PHP_CodeSniffer_Tokens as Tokens; use Symfony\Component\Yaml\Yaml; /** - * Sniff that handles all calls to deprecated functions. + * Sniff that handles all calls to removed functions. * - * A single array defines the deprecations, see $deprecatedFunctions. + * A single array defines the deprecations, see $removedFunctions. */ -class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSniff +class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff { use \Typo3Update\Sniffs\ExtendedPhpCsSupportTrait; use \Typo3Update\Sniffs\OptionsAccessTrait; /** - * Configuration to define deprecated functions. + * Configuration to define removed functions. * * @var array */ - protected static $deprecatedFunctions = []; + protected static $removedFunctions = []; /** * Function for the current sniff instance. * @var array */ - private $deprecatedFunction = []; + private $removedFunction = []; /** * TODO: Multiple files allowed, using glob ... to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... */ public function __construct() { - if (static::$deprecatedFunctions === []) { - foreach ($this->getDeprecatedFunctionConfigFiles() as $file) { - static::$deprecatedFunctions = array_merge( - static::$deprecatedFunctions, + if (static::$removedFunctions === []) { + foreach ($this->getRemovedFunctionConfigFiles() as $file) { + static::$removedFunctions = array_merge( + static::$removedFunctions, $this->prepareStructure(Yaml::parse(file_get_contents((string) $file))) ); } @@ -65,7 +65,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni /** * Prepares structure from config for later usage. * - * @param array $deprecatedFunctions + * @param array $removedFunctions * @return array */ protected function prepareStructure(array $oldStructure) @@ -84,7 +84,6 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni $newStructure[$function]['fqcn'] = null; $newStructure[$function]['class'] = null; $newStructure[$function]['function'] = $split[0]; - // TODO: Add a way to check for removed or deprecated. $newStructure[$function]['version_removed'] = $typo3Version; // If split contains two parts, it's a class with method @@ -124,7 +123,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ public function process(PhpCsFile $phpcsFile, $stackPtr) { - if (!$this->isFunctionCallDeprecated($phpcsFile, $stackPtr)) { + if (!$this->isFunctionCallRemoved($phpcsFile, $stackPtr)) { return; } @@ -132,11 +131,11 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni } /** - * Check whether function at given point is deprecated. + * Check whether function at given point is removed. * * @return bool */ - protected function isFunctionCallDeprecated(PhpCsFile $phpcsFile, $stackPtr) + protected function isFunctionCallRemoved(PhpCsFile $phpcsFile, $stackPtr) { if (!$this->isFunctionCall($phpcsFile, $stackPtr)) { return false; @@ -160,13 +159,13 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni } } - return $this->getDeprecatedFunction($functionName, $class, $isStatic) !== []; + return $this->getRemovedFunction($functionName, $class, $isStatic) !== []; } /** - * Returns all matching deprecated functions for given arguments. + * Returns all matching removed functions for given arguments. * - * Also prepares functions for later usages in $this->deprecatedFunction. + * Also prepares functions for later usages in $this->removedFunction. * * @param string $functionName * @param string $className The last part of the class name, splitted by namespaces. @@ -174,7 +173,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * * @return array */ - protected function getDeprecatedFunction($functionName, $className, $isStatic) + protected function getRemovedFunction($functionName, $className, $isStatic) { // We will not match any static method, without the class name, at least for now. // Otherwise we could handle them the same way as instance methods. @@ -182,8 +181,8 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni return []; } - $this->deprecatedFunction = array_filter( - static::$deprecatedFunctions, + $this->removedFunction = array_filter( + static::$removedFunctions, function ($config) use ($functionName, $isStatic, $className) { return $functionName === $config['function'] && $isStatic === $config['static'] @@ -195,7 +194,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni } ); - return $this->deprecatedFunction; + return $this->removedFunction; } /** @@ -203,9 +202,9 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni * * @return array */ - protected function getCurrentDeprecatedFunction() + protected function getCurrentRemovedFunction() { - $config = current($this->deprecatedFunction); + $config = current($this->removedFunction); // TODO: Add exception if something went wrong? @@ -223,13 +222,11 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) { $phpcsFile->addWarning( - // TODO: Add a way to check for removed or deprecated. 'Legacy function calls are not allowed; found %s. Removed in %s. %s. See: %s', $tokenPosition, $this->getFunctionIdentifier(), [ $this->getOldfunctionCall(), - // TODO: Add a way to check for removed or deprecated. $this->getRemovedVersion(), $this->getNewFunctionCall(), $this->getDocsUrl(), @@ -244,7 +241,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getFunctionIdentifier() { - $config = $this->getCurrentDeprecatedFunction(); + $config = $this->getCurrentRemovedFunction(); return $config['class'] . '.' . $config['function']; } @@ -259,7 +256,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getOldFunctionCall() { - $config = $this->getCurrentDeprecatedFunction(); + $config = $this->getCurrentRemovedFunction(); $concat = '->'; if ($config['static']) { $concat = '::'; @@ -276,7 +273,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getRemovedVersion() { - return $this->getCurrentDeprecatedFunction()['version_removed']; + return $this->getCurrentRemovedFunction()['version_removed']; } /** @@ -288,7 +285,7 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getNewFunctionCall() { - $newCall = $this->getCurrentDeprecatedFunction()['newFunctionCall']; + $newCall = $this->getCurrentRemovedFunction()['newFunctionCall']; if ($newCall !== null) { return $newCall; } @@ -302,6 +299,6 @@ class Typo3Update_Sniffs_Deprecated_GenericFunctionCallSniff implements PhpCsSni */ protected function getDocsUrl() { - return $this->getCurrentDeprecatedFunction()['docsUrl']; + return $this->getCurrentRemovedFunction()['docsUrl']; } } From 1c4fce23157263425dcb9e9c2a489f1c7ea7bd09 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 Mar 2017 11:16:45 +0200 Subject: [PATCH 11/16] TASK: Adjust for CGL --- .../Sniffs/Deprecated/AjaxRegistrationSniff.php | 3 +++ .../Sniffs/Removed/GenericFunctionCallSniff.php | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php index 603ea88..355e408 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php @@ -24,6 +24,9 @@ use PHP_CodeSniffer_Sniff as PhpCsSniff; use PHP_CodeSniffer_Tokens as PhpCsTokens; /** + * Analyses feature 6991. + * + * @see https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.6/Feature-69916-PSR-7-basedRoutingForBackendAJAXRequests.html */ class Typo3Update_Sniffs_Deprecated_AjaxRegistrationSniff implements PhpCsSniff { diff --git a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php index 2a106de..7420a63 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php @@ -48,7 +48,8 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff private $removedFunction = []; /** - * TODO: Multiple files allowed, using glob ... to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... + * TODO: Multiple files allowed, using glob ... + * to allow splitting per ext (extbase, fluid, ...) and TYPO3 Version 7.1, 7.0, ... */ public function __construct() { @@ -65,7 +66,7 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff /** * Prepares structure from config for later usage. * - * @param array $removedFunctions + * @param array $oldStructure * @return array */ protected function prepareStructure(array $oldStructure) @@ -89,7 +90,10 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff // If split contains two parts, it's a class with method if (isset($split[1])) { $newStructure[$function]['fqcn'] = $split[0]; - $newStructure[$function]['class'] = array_slice(explode('\\', $newStructure[$function]['fqcn']), -1)[0]; + $newStructure[$function]['class'] = array_slice( + explode('\\', $newStructure[$function]['fqcn']), + -1 + )[0]; $newStructure[$function]['function'] = $split[1]; } }; From 56d692bac7ed2a60706c0d09837ac0dce75cc7fa Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 30 Mar 2017 13:18:18 +0200 Subject: [PATCH 12/16] TASK: Add missing docs * Add docs for new feature. Relates: #33 --- Readme.rst | 26 +++++++++++++++++++ .../Typo3Update/Sniffs/OptionsAccessTrait.php | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Readme.rst b/Readme.rst index a7a1243..e87a3a8 100644 --- a/Readme.rst +++ b/Readme.rst @@ -100,6 +100,14 @@ Also we check for the following deprecated calls: - Check for ``create`` on ``ObjectManager``, which is "stupid" just all ``create`` calls are marked with a warning. +Beside the features above which are covered by ``phpcs`` and phpcbf``, the following linting is also +available to generate a report of possible issues and during coding through ``phpcs``: + +- Check for usage of removed functions. + The functions are configured via yaml files. The location of them is configurable, default is + inside the standard itself, and we try to deliver all information. + For configuration options see ``removedFunctionConfigFiles``. + What does it look like? ======================= @@ -194,3 +202,21 @@ Example: .. code:: bash --runtime-set vendor YourVendor + +``removedFunctionConfigFiles`` + Configure your vendor through ``ruleset.xml`` or using ``--runtime-set``. Default is + ``Configuration/Removed/Functions/*.yaml`` inside the standard itself. + Globing is used, so placeholders like ``*`` are possible, see + https://secure.php.net/manual/en/function.glob.php + + Example: + +.. code:: xml + + + +Example: + +.. code:: bash + + --runtime-set removedFunctionConfigFiles "/Some/Absolute/Path/*.yaml" diff --git a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php index 9db7ee7..9920467 100644 --- a/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php +++ b/src/Standards/Typo3Update/Sniffs/OptionsAccessTrait.php @@ -62,7 +62,7 @@ trait OptionsAccessTrait */ public function getRemovedFunctionConfigFiles() { - $configFiles = PhpCs::getConfigData('removedfunctionConfigFiles'); + $configFiles = PhpCs::getConfigData('removedFunctionConfigFiles'); if (!$configFiles) { $configFiles = __DIR__ . '/../Configuration/Removed/Functions/*.yaml'; } From aa8ffab3fa76030c41c464f0e66756536fd87acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hu=CC=88rtgen?= Date: Thu, 30 Mar 2017 16:58:34 +0200 Subject: [PATCH 13/16] TASK: Rename removed function method --- .../Sniffs/Removed/GenericFunctionCallSniff.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php index 7420a63..8b97280 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php @@ -163,26 +163,26 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff } } - return $this->getRemovedFunction($functionName, $class, $isStatic) !== []; + $this->detectRemovedFunctions($functionName, $class, $isStatic) + + return $this->removedFunction !== []; } /** - * Returns all matching removed functions for given arguments. - * - * Also prepares functions for later usages in $this->removedFunction. + * Detect removed functions for given arguments. * * @param string $functionName * @param string $className The last part of the class name, splitted by namespaces. * @param bool $isStatic * - * @return array + * @return void */ - protected function getRemovedFunction($functionName, $className, $isStatic) + protected function detectRemovedFunctions($functionName, $className, $isStatic) { // We will not match any static method, without the class name, at least for now. // Otherwise we could handle them the same way as instance methods. if ($isStatic === true && $className === false) { - return []; + return; } $this->removedFunction = array_filter( @@ -197,8 +197,6 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff ; } ); - - return $this->removedFunction; } /** From 9c6085642e6d8233c25adad06ae27c9c7584656a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Apr 2017 08:12:14 +0200 Subject: [PATCH 14/16] BUGFIX: Respect double quotes for ajax deprecation Relates: #33 --- .../Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php index 355e408..14574ac 100644 --- a/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Deprecated/AjaxRegistrationSniff.php @@ -67,7 +67,7 @@ class Typo3Update_Sniffs_Deprecated_AjaxRegistrationSniff implements PhpCsSniff } $tokens = $phpcsFile->getTokens(); - if ($tokens[$stackPtr]['content'] !== "'AJAX'") { + if (preg_match('/"AJAX"|\'AJAX\'/', $tokens[$stackPtr]['content']) !== 1) { return; } $equalSign = $phpcsFile->findNext(T_EQUAL, $stackPtr, null, false, null, true); From 830584fa8788915e6330941c1f7f27f316ec8b8b Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Apr 2017 08:31:36 +0200 Subject: [PATCH 15/16] TASK: Improve docs --- .../Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php index 8b97280..706d892 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php @@ -27,7 +27,8 @@ use Symfony\Component\Yaml\Yaml; /** * Sniff that handles all calls to removed functions. * - * A single array defines the deprecations, see $removedFunctions. + * Removed functions are configured using YAML-Files, for examples see src/Standards/Typo3Update/Configuration/Removed/Functions/7.0.yaml + * Also check out the configuration options in Readme.rst. */ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff { From 034ab57a34af371ee3325c7c92637d8b8833f7df Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Apr 2017 08:31:54 +0200 Subject: [PATCH 16/16] TASK: Skip unnecessary function call --- .../Removed/GenericFunctionCallSniff.php | 100 ++++++++---------- 1 file changed, 47 insertions(+), 53 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php index 706d892..b81ff7d 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/GenericFunctionCallSniff.php @@ -40,13 +40,13 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff * * @var array */ - protected static $removedFunctions = []; + protected static $configuredFunctions = []; /** * Function for the current sniff instance. * @var array */ - private $removedFunction = []; + private $removedFunctions = []; /** * TODO: Multiple files allowed, using glob ... @@ -54,10 +54,10 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff */ public function __construct() { - if (static::$removedFunctions === []) { + if (static::$configuredFunctions === []) { foreach ($this->getRemovedFunctionConfigFiles() as $file) { - static::$removedFunctions = array_merge( - static::$removedFunctions, + static::$configuredFunctions = array_merge( + static::$configuredFunctions, $this->prepareStructure(Yaml::parse(file_get_contents((string) $file))) ); } @@ -67,16 +67,15 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff /** * Prepares structure from config for later usage. * - * @param array $oldStructure + * @param array $typo3Versions * @return array */ - protected function prepareStructure(array $oldStructure) + protected function prepareStructure(array $typo3Versions) { - $typo3Versions = array_keys($oldStructure); $newStructure = []; - foreach ($typo3Versions as $typo3Version) { - foreach ($oldStructure[$typo3Version] as $function => $config) { + foreach ($typo3Versions as $typo3Version => $functions) { + foreach ($functions as $function => $config) { // Split static methods and methods. $split = preg_split('/::|->/', $function); @@ -164,13 +163,12 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff } } - $this->detectRemovedFunctions($functionName, $class, $isStatic) - - return $this->removedFunction !== []; + $this->removedFunctions = $this->getMatchingRemovedFunctions($functionName, $class, $isStatic); + return $this->removedFunctions !== []; } /** - * Detect removed functions for given arguments. + * Returns all matching removed functions for given arguments. * * @param string $functionName * @param string $className The last part of the class name, splitted by namespaces. @@ -178,7 +176,7 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff * * @return void */ - protected function detectRemovedFunctions($functionName, $className, $isStatic) + protected function getMatchingRemovedFunctions($functionName, $className, $isStatic) { // We will not match any static method, without the class name, at least for now. // Otherwise we could handle them the same way as instance methods. @@ -186,8 +184,8 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff return; } - $this->removedFunction = array_filter( - static::$removedFunctions, + return array_filter( + static::$configuredFunctions, function ($config) use ($functionName, $isStatic, $className) { return $functionName === $config['function'] && $isStatic === $config['static'] @@ -195,25 +193,11 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff $className === $config['class'] || $className === false ) - ; + ; } ); } - /** - * Returns configuration for currently checked function. - * - * @return array - */ - protected function getCurrentRemovedFunction() - { - $config = current($this->removedFunction); - - // TODO: Add exception if something went wrong? - - return $config; - } - /** * Add warning for the given token position. * @@ -224,27 +208,30 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff */ protected function addWarning(PhpCsFile $phpcsFile, $tokenPosition) { - $phpcsFile->addWarning( - 'Legacy function calls are not allowed; found %s. Removed in %s. %s. See: %s', - $tokenPosition, - $this->getFunctionIdentifier(), - [ - $this->getOldfunctionCall(), - $this->getRemovedVersion(), - $this->getNewFunctionCall(), - $this->getDocsUrl(), - ] - ); + foreach ($this->removedFunctions as $function) { + $phpcsFile->addWarning( + 'Legacy function calls are not allowed; found %s. Removed in %s. %s. See: %s', + $tokenPosition, + $this->getFunctionIdentifier($function), + [ + $this->getOldfunctionCall($function), + $this->getRemovedVersion($function), + $this->getNewFunctionCall($function), + $this->getDocsUrl($function), + ] + ); + } } /** * Identifier for configuring this specific error / warning through PHPCS. * + * @param array $config The converted structure for a single function. + * * @return string */ - protected function getFunctionIdentifier() + protected function getFunctionIdentifier(array $config) { - $config = $this->getCurrentRemovedFunction(); return $config['class'] . '.' . $config['function']; } @@ -255,11 +242,12 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff * you should provide an example, so users can check that this is the * legacy one. * + * @param array $config The converted structure for a single function. + * * @return string */ - protected function getOldFunctionCall() + protected function getOldFunctionCall(array $config) { - $config = $this->getCurrentRemovedFunction(); $concat = '->'; if ($config['static']) { $concat = '::'; @@ -272,11 +260,13 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff * * To let user decide whether this is important for him. * + * @param array $config The converted structure for a single function. + * * @return string */ - protected function getRemovedVersion() + protected function getRemovedVersion(array $config) { - return $this->getCurrentRemovedFunction()['version_removed']; + return $config['version_removed']; } /** @@ -284,11 +274,13 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff * * To provide feedback for user to ease migration. * + * @param array $config The converted structure for a single function. + * * @return string */ - protected function getNewFunctionCall() + protected function getNewFunctionCall(array $config) { - $newCall = $this->getCurrentRemovedFunction()['newFunctionCall']; + $newCall = $config['newFunctionCall']; if ($newCall !== null) { return $newCall; } @@ -298,10 +290,12 @@ class Typo3Update_Sniffs_Removed_GenericFunctionCallSniff implements PhpCsSniff /** * Allow user to lookup the official docs related to this deprecation / breaking change. * + * @param array $config The converted structure for a single function. + * * @return string */ - protected function getDocsUrl() + protected function getDocsUrl(array $config) { - return $this->getCurrentRemovedFunction()['docsUrl']; + return $config['docsUrl']; } }