From 896117aa0127b5e4b907ee674de0e80d27ef0949 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:25:35 +0200 Subject: [PATCH 01/18] TASK: Add docs how to lint TypoScript Relates: #54 --- Documentation/source/usage.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/source/usage.rst b/Documentation/source/usage.rst index 0159d9c..2d231cb 100644 --- a/Documentation/source/usage.rst +++ b/Documentation/source/usage.rst @@ -31,6 +31,17 @@ You might want to add ``-p --colors`` to see that something is happening. Also make sure to ignore certain files like libraries or js and css files while running the update. Check out the official docs for how to do so. +Lint TypoScript +--------------- + +To lint TypoScript, include the files in your linting and add the following arguments per file +extension:: + + --extensions=txt/TypoScript,ts/TypoScript + +Make sure to ignore files with same file extension but different meaning, like documentatons, readme +or changelogs. + FAQ --- From e7dbac4d33d822f2d2e429aa39ad2ccdda3f8c89 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:31:32 +0200 Subject: [PATCH 02/18] TASK: Cleanup php code * Adjust variable name, as this is generic and not about constants. --- .../Sniffs/Removed/AbstractGenericUsage.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php b/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php index 13697f0..87e5caf 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php @@ -45,7 +45,7 @@ abstract class AbstractGenericUsage implements PhpCsSniff protected $configured = []; /** - * Constant for the current sniff instance. + * Entries removed in current sniff. * @var array */ protected $removed = []; @@ -203,16 +203,16 @@ abstract class AbstractGenericUsage implements PhpCsSniff */ protected function addMessage(PhpCsFile $phpcsFile, $tokenPosition) { - foreach ($this->removed as $constant) { + foreach ($this->removed as $removed) { $phpcsFile->addWarning( 'Legacy calls are not allowed; found %s. Removed in %s. %s. See: %s', $tokenPosition, - $this->getIdentifier($constant), + $this->getIdentifier($removed), [ - $this->getOldUsage($constant), - $this->getRemovedVersion($constant), - $this->getReplacement($constant), - $this->getDocsUrl($constant), + $this->getOldUsage($removed), + $this->getRemovedVersion($removed), + $this->getReplacement($removed), + $this->getDocsUrl($removed), ] ); } @@ -283,7 +283,7 @@ abstract class AbstractGenericUsage implements PhpCsSniff /** * Allow user to lookup the official docs related to this deprecation / breaking change. * - * @param array $config The converted structure for a single constant. + * @param array $config * * @return string */ From 7a999212e20414e142ce27d7a31750791e0a9597 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:32:20 +0200 Subject: [PATCH 03/18] FEATURE: Add first TypoScript sniff * Add configuration for removed object identifiers. * Add sniff for removed object identifiers. Relates: #54 --- .../TypoScript/ObjectIdentifier/7.0.yaml | 5 ++ .../TypoScriptObjectIdentifierSniff.php | 86 +++++++++++++++++++ .../Expected.json | 33 +++++++ .../InputFileForIssues.ts | 4 + 4 files changed, 128 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml create mode 100644 src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml new file mode 100644 index 0000000..33fa3d1 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml @@ -0,0 +1,5 @@ +# Breaking changes in 7.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Index.html#breaking-changes +'7.0': + styles.insertContent: + replacement: 'Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html' diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php new file mode 100644 index 0000000..d3c6db8 --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php @@ -0,0 +1,86 @@ + + */ + public function register() + { + return [ + TokenInterface::TYPE_OBJECT_IDENTIFIER, + ]; + } + + /** + * Check whether the current token is removed. + * + * @param PhpCsFile $phpcsFile + * @param int $stackPtr + * @return bool + */ + protected function isRemoved(PhpCsFile $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + $objectIdentifier = $token['content']; + + if (isset($this->configured[$objectIdentifier])) { + $this->removed = [ + $this->configured[$objectIdentifier] + ]; + return true; + } + + return false; + } + + /** + * Identifier for configuring this specific error / warning through PHPCS. + * + * @param array $config + * + * @return string + */ + protected function getIdentifier(array $config) + { + return str_replace('.', '-', $config['name']); + } + + /** + * The original call, to allow user to check matches. + * + * As we match the name, that can be provided by multiple classes, you + * should provide an example, so users can check that this is the legacy + * one. + * + * @param array $config + * + * @return string + */ + protected function getOldUsage(array $config) + { + return $config['name']; + } + + /** + * Return file names containing removed configurations. + * + * @return array + */ + protected function getRemovedConfigFiles() + { + return Options::getRemovedTypoScriptObjectIdentifierConfigFiles(); + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json new file mode 100644 index 0000000..f5f9a91 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json @@ -0,0 +1,33 @@ +{ + "files": { + "InputFileForIssues.ts": { + "errors": 0, + "messages": [ + { + "column": 10, + "fixable": false, + "line": 2, + "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "type": "WARNING" + }, + { + "column": 11, + "fixable": false, + "line": 3, + "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "type": "WARNING" + } + ], + "warnings": 2 + } + }, + "totals": { + "errors": 0, + "fixable": 0, + "warnings": 2 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts new file mode 100644 index 0000000..660a53c --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts @@ -0,0 +1,4 @@ +page { + 10 < styles.insertContent + 10 =< styles.insertContent +} From 154fe435828355bda25a8c5d7269bb77a5be57bb Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:39:08 +0200 Subject: [PATCH 04/18] FEATURE: Allow multiple files to be used as insert for tests * Detect file for php and TS out of the box. * Keep old handling to configure file name. * Also detect file format, e.g. TypoScript, and configure phpcs tokenizer accordingly. Relates: #54 --- tests/SniffsTest.php | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/tests/SniffsTest.php b/tests/SniffsTest.php index 2560f1a..a82bebd 100644 --- a/tests/SniffsTest.php +++ b/tests/SniffsTest.php @@ -114,6 +114,12 @@ class SniffsTest extends TestCase */ protected function executeSniff(\SplFileInfo $folder, array $arguments = []) { + $fileName = ''; + if (isset($arguments['inputFileName'])) { + $fileName = $arguments['inputFileName']; + unset($arguments['inputFileName']); + } + $internalArguments = array_merge_recursive([ 'standard' => 'Typo3Update', 'runtime-set' => [ @@ -123,14 +129,11 @@ class SniffsTest extends TestCase ], 'report' => 'json', 'sniffs' => $this->getSniffByFolder($folder), - 'inputFile' => $folder->getRealPath() . DIRECTORY_SEPARATOR . 'InputFileForIssues.php', + 'inputFile' => $this->getInputFile($folder, $fileName), ], $arguments); - if (isset($internalArguments['inputFileName'])) { - $internalArguments['inputFile'] = $folder->getRealPath() - . DIRECTORY_SEPARATOR - . $internalArguments['inputFileName']; - unset($internalArguments['inputFileName']); + if (strpos($internalArguments['inputFile'], '.ts') !== false) { + $internalArguments['extensions'] = 'ts/TypoScript'; } $this->assertEquals( @@ -229,6 +232,35 @@ class SniffsTest extends TestCase return $folder->getRealPath() . DIRECTORY_SEPARATOR . 'Arguments.php'; } + /** + * Get absolute file path to file to use for testing. + * + * @param \SplFileInfo $folder + * @param string $fileName + * @return string + */ + protected function getInputFile(\SplFileInfo $folder, $fileName = '') + { + $folderPath = $folder->getRealPath() . DIRECTORY_SEPARATOR; + $file = $folderPath . $fileName; + + if (!is_file($file)) { + $file = $folderPath . $fileName; + } + if (!is_file($file)) { + $file = $folderPath . 'InputFileForIssues.php'; + } + if (!is_file($file)) { + $file = $folderPath . 'InputFileForIssues.ts'; + } + + if (!is_file($file)) { + throw new \Exception('message', 1492083289); + } + + return $file; + } + /** * Build cli call for phpcs. * From 920c923ed7d9f3e3ab7f7dbe04b865230ec345e4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:40:04 +0200 Subject: [PATCH 05/18] FEATURE: Add missing method to make tests pass. * Retrieve yaml files for removed typoscript object identifier. Relates: #54 --- src/Standards/Typo3Update/Sniffs/Options.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Standards/Typo3Update/Sniffs/Options.php b/src/Standards/Typo3Update/Sniffs/Options.php index c6b5ba7..bae8ef0 100644 --- a/src/Standards/Typo3Update/Sniffs/Options.php +++ b/src/Standards/Typo3Update/Sniffs/Options.php @@ -81,6 +81,19 @@ class Options ); } + /** + * Returns an array of absolute file names containing removed typoscript object identifier configurations. + * + * @return array + */ + public static function getRemovedTypoScriptObjectIdentifierConfigFiles() + { + return static::getOptionFileNames( + 'removedTypoScriptObjectIdentifier', + __DIR__ . '/../Configuration/Removed/TypoScript/ObjectIdentifier/*.yaml' + ); + } + /** * Get the option by optionName, if not defined, use default. * From b394cff3d2429d6542e274da442fd7f160812532 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 13:48:01 +0200 Subject: [PATCH 06/18] TASK: Add new configuration option to docs Relates: #54 --- Documentation/source/configuration.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index 6209816..df98fb8 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -156,3 +156,25 @@ Example: .. code:: bash --runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml" + +.. _configuration-removedTypoScriptObjectIdentifierConfigFiles: + +removedTypoScriptObjectIdentifierConfigFiles +-------------------------------------------- + +Configure where to look for configuration files defining the removed TypoScript object identifiers. +Default is ``Configuration/Removed/TypoScript/ObjectIdentifier/*.yaml`` inside the standard itself. +We already try to deliver as much as possible. Globing is used, so placeholders like ``*`` are +possible, see https://secure.php.net/manual/en/function.glob.php + +Using :file:`ruleset.xml`: + +.. code:: xml + + + +Example: + +.. code:: bash + + --runtime-set removedTypoScriptObjectIdentifierConfigFiles "/Some/Absolute/Path/*.yaml" From e1b3f31c780bfe91490ef97b9df7a2b265f72e63 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 14:20:36 +0200 Subject: [PATCH 07/18] FEATURE: Add second TypoScript check * Extend test to show what's possible and covered and what is not covered yet. Relates: #54 --- .../TypoScript/ObjectIdentifier/7.0.yaml | 3 +++ .../Expected.json | 22 +++++++++++++++++-- .../InputFileForIssues.ts | 15 +++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml index 33fa3d1..505ace8 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml @@ -3,3 +3,6 @@ styles.insertContent: replacement: 'Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html' + mod.web_list.alternateBgColors: + replacement: 'Removed without substitution' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html' diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json index f5f9a91..e40c7dd 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json @@ -20,14 +20,32 @@ "severity": 5, "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", "type": "WARNING" + }, + { + "column": 1, + "fixable": false, + "line": 6, + "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "type": "WARNING" + }, + { + "column": 1, + "fixable": false, + "line": 13, + "message": "Legacy calls are not allowed; found mod.web_list.alternateBgColors. Removed in 7.0. Removed without substitution. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.mod-web_list-alternateBgColors", + "type": "WARNING" } ], - "warnings": 2 + "warnings": 4 } }, "totals": { "errors": 0, "fixable": 0, - "warnings": 2 + "warnings": 4 } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts index 660a53c..3696fb7 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts @@ -2,3 +2,18 @@ page { 10 < styles.insertContent 10 =< styles.insertContent } + +styles.insertContent { + select { + where = colPos=1 + } +} + +# already covered +mod.web_list.alternateBgColors = 1 +# Not covered yet +mod { + web_list { + alternateBgColors = 1 + } +} From 2e7f155b8d7c3d9f35967d16dccdf61bf22edeca Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 14:57:33 +0200 Subject: [PATCH 08/18] TASK: Configure all 7.0 breaking changed for ObjectIdentifier Relates: #54 --- .../TypoScript/ObjectIdentifier/7.0.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml index 505ace8..ad72f4c 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml @@ -6,3 +6,21 @@ mod.web_list.alternateBgColors: replacement: 'Removed without substitution' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html' + acronym: + replacement: 'User TSconfig must be modified to refer to "abbreviation" instead of "acronym"' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-54409-RteAcronymButtonRenamedAbbreviation.html' + features.rewrittenPropertyMapper: + replacement: 'it is no longer possible to deactivate the feature. If configured with 1, just remove, otherwise adjust your code.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + config.notification_email_charset: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62793-RemoveConfigNotification.html' + config.notification_email_encoding: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62793-RemoveConfigNotification.html' + config.notification_email_urlmode: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62793-RemoveConfigNotification.html' + config.uniqueLinkVars: + replacement: 'The setting config.uniqueLinkVars has been removed as the behaviour is now always used' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62888-RemoveUniqueLinkVars.html' From 12fcc704dcaa9bdaac4a6475146b8dbe41f6cd33 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:21:59 +0200 Subject: [PATCH 09/18] TASK: Fix php syntax issue * It's not even a warning, but still wrong --- .../Typo3Update/Sniffs/Removed/AbstractGenericUsage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php b/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php index 87e5caf..6094bdc 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/AbstractGenericUsage.php @@ -101,7 +101,7 @@ abstract class AbstractGenericUsage implements PhpCsSniff )[0]; $newStructure[$removed]['name'] = $split[1]; } - }; + } } return $newStructure; From ca4d687155081cda0dd4ca82b4ee3e54a09eb0fe Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:22:38 +0200 Subject: [PATCH 10/18] FEATURE: Also check TypoScript objects * Not only check paths, but also objects like cObjects. * Update test input for verification. * Add further breaking changes for 7.1 --- .../TypoScript/ObjectIdentifier/7.1.yaml | 26 +++++++++++++++ .../TypoScriptObjectIdentifierSniff.php | 33 ++++++++++++++++++- .../InputFileForIssues.ts | 12 +++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml new file mode 100644 index 0000000..183d76b --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml @@ -0,0 +1,26 @@ +# Breaking changes in 8.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Index.html#breaking-changes +'7.1': + lib.parseFunc_RTE.externalBlocks.blockquote.callRecursive.tagStdWrap.HTMLparser: + replacement: 'It is recommended to fix the margins inside your website CSS. Alternatively, you can re-add the above TypoScript lines to your website TypoScript template (not recommended)' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-44879-CSSStyledContentTypoScriptBlockQuoteInlineStylesRemoved.html' + lib.parseFunc_RTE.externalBlocks.blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs: + replacement: 'It is recommended to fix the margins inside your website CSS. Alternatively, you can re-add the above TypoScript lines to your website TypoScript template (not recommended)' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-44879-CSSStyledContentTypoScriptBlockQuoteInlineStylesRemoved.html' + config.meaningfulTempFilePrefix: + replacement: 'All files will always have their original filename fully prepended when stored in the folder typo3temp/GB/. Just remove the setting' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-62886-RemoveMeaningfulTempFilePrefix.html' + new CLEARGIF: + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' + new COLUMNS: + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' + new CTABLE: + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' + new OTABLE: + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' + new HRULER: + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php index d3c6db8..0bc61f4 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php @@ -19,10 +19,41 @@ class Typo3Update_Sniffs_Removed_TypoScriptObjectIdentifierSniff extends Abstrac public function register() { return [ + TokenInterface::TYPE_OBJECT_CONSTRUCTOR, TokenInterface::TYPE_OBJECT_IDENTIFIER, ]; } + /** + * Prepares structure from config for later usage. + * + * @param array $typo3Versions + * @return array + */ + protected function prepareStructure(array $typo3Versions) + { + $newStructure = []; + + foreach ($typo3Versions as $typo3Version => $removals) { + foreach ($removals as $removed => $config) { + + $config['type'] = TokenInterface::TYPE_OBJECT_IDENTIFIER; + // If starting with new, it's a constructor, meaning content object or other Object. + if (strtolower(substr($removed, 0, 4)) === 'new ') { + $config['type'] = TokenInterface::TYPE_OBJECT_CONSTRUCTOR; + $removed = substr($removed, 4); + } + + $config['name'] = $removed; + $config['version_removed'] = $typo3Version; + + $newStructure[$removed] = $config; + } + } + + return $newStructure; + } + /** * Check whether the current token is removed. * @@ -36,7 +67,7 @@ class Typo3Update_Sniffs_Removed_TypoScriptObjectIdentifierSniff extends Abstrac $token = $tokens[$stackPtr]; $objectIdentifier = $token['content']; - if (isset($this->configured[$objectIdentifier])) { + if (isset($this->configured[$objectIdentifier]) && $token['type'] === $this->configured[$objectIdentifier]['type']) { $this->removed = [ $this->configured[$objectIdentifier] ]; diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts index 3696fb7..3f9b94c 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts @@ -17,3 +17,15 @@ mod { alternateBgColors = 1 } } + +page { + CLEARGIF { + value = test + } + + 10 = CLEARGIF + 11 = COLUMNS + 12 = CTABLE + 13 = OTABLE + 14 = HRULER +} From 3e9d8c01c8a994de145ce16cfa2b545e73d99ae4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:27:25 +0200 Subject: [PATCH 11/18] TASK: Rename TypoScript sniff * As we not only check ObjectIdentifier's anymore, but also further parts, renamce sniff to be more generic. * Also rename configuration and tests accordingly. Relates: #54 --- Documentation/source/configuration.rst | 12 ++++++------ .../TypoScript/{ObjectIdentifier => }/7.0.yaml | 0 .../TypoScript/{ObjectIdentifier => }/7.1.yaml | 0 src/Standards/Typo3Update/Sniffs/Options.php | 8 ++++---- ...ObjectIdentifierSniff.php => TypoScriptSniff.php} | 4 ++-- .../Expected.json | 0 .../InputFileForIssues.ts | 0 7 files changed, 12 insertions(+), 12 deletions(-) rename src/Standards/Typo3Update/Configuration/Removed/TypoScript/{ObjectIdentifier => }/7.0.yaml (100%) rename src/Standards/Typo3Update/Configuration/Removed/TypoScript/{ObjectIdentifier => }/7.1.yaml (100%) rename src/Standards/Typo3Update/Sniffs/Removed/{TypoScriptObjectIdentifierSniff.php => TypoScriptSniff.php} (94%) rename tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/{TypoScriptObjectIdentifierSniff => TypoScriptSniff}/Expected.json (100%) rename tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/{TypoScriptObjectIdentifierSniff => TypoScriptSniff}/InputFileForIssues.ts (100%) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index df98fb8..cd2812d 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -157,13 +157,13 @@ Example: --runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml" -.. _configuration-removedTypoScriptObjectIdentifierConfigFiles: +.. _configuration-removedTypoScriptConfigFiles: -removedTypoScriptObjectIdentifierConfigFiles --------------------------------------------- +removedTypoScriptConfigFiles +---------------------------- Configure where to look for configuration files defining the removed TypoScript object identifiers. -Default is ``Configuration/Removed/TypoScript/ObjectIdentifier/*.yaml`` inside the standard itself. +Default is ``Configuration/Removed/TypoScript/*.yaml`` inside the standard itself. We already try to deliver as much as possible. Globing is used, so placeholders like ``*`` are possible, see https://secure.php.net/manual/en/function.glob.php @@ -171,10 +171,10 @@ Using :file:`ruleset.xml`: .. code:: xml - + Example: .. code:: bash - --runtime-set removedTypoScriptObjectIdentifierConfigFiles "/Some/Absolute/Path/*.yaml" + --runtime-set removedTypoScriptConfigFiles "/Some/Absolute/Path/*.yaml" diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.0.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.0.yaml rename to src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.0.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml similarity index 100% rename from src/Standards/Typo3Update/Configuration/Removed/TypoScript/ObjectIdentifier/7.1.yaml rename to src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml diff --git a/src/Standards/Typo3Update/Sniffs/Options.php b/src/Standards/Typo3Update/Sniffs/Options.php index bae8ef0..cc79f7b 100644 --- a/src/Standards/Typo3Update/Sniffs/Options.php +++ b/src/Standards/Typo3Update/Sniffs/Options.php @@ -82,15 +82,15 @@ class Options } /** - * Returns an array of absolute file names containing removed typoscript object identifier configurations. + * Returns an array of absolute file names containing removed typoscript. * * @return array */ - public static function getRemovedTypoScriptObjectIdentifierConfigFiles() + public static function getRemovedTypoScriptConfigFiles() { return static::getOptionFileNames( - 'removedTypoScriptObjectIdentifier', - __DIR__ . '/../Configuration/Removed/TypoScript/ObjectIdentifier/*.yaml' + 'removedTypoScript', + __DIR__ . '/../Configuration/Removed/TypoScript/*.yaml' ); } diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php similarity index 94% rename from src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php rename to src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php index 0bc61f4..f812edb 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php @@ -5,7 +5,7 @@ use PHP_CodeSniffer_File as PhpCsFile; use Typo3Update\Sniffs\Options; use Typo3Update\Sniffs\Removed\AbstractGenericUsage; -class Typo3Update_Sniffs_Removed_TypoScriptObjectIdentifierSniff extends AbstractGenericUsage +class Typo3Update_Sniffs_Removed_TypoScriptSniff extends AbstractGenericUsage { public $supportedTokenizers = [ 'TYPOSCRIPT', @@ -112,6 +112,6 @@ class Typo3Update_Sniffs_Removed_TypoScriptObjectIdentifierSniff extends Abstrac */ protected function getRemovedConfigFiles() { - return Options::getRemovedTypoScriptObjectIdentifierConfigFiles(); + return Options::getRemovedTypoScriptConfigFiles(); } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json similarity index 100% rename from tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/Expected.json rename to tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts similarity index 100% rename from tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptObjectIdentifierSniff/InputFileForIssues.ts rename to tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/InputFileForIssues.ts From 7c5d95d0e0a0cd40a6f9fbcc0fa56bbf2d804627 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:30:42 +0200 Subject: [PATCH 12/18] TASK: Update test * Make sure test is running again with new additions of cObjects. * Also fix description containing dot at the end. Relates: #54 --- .../Configuration/Removed/TypoScript/7.1.yaml | 10 ++-- .../Removed/TypoScriptSniff/Expected.json | 57 +++++++++++++++++-- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml index 183d76b..4433df2 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml @@ -10,17 +10,17 @@ replacement: 'All files will always have their original filename fully prepended when stored in the folder typo3temp/GB/. Just remove the setting' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-62886-RemoveMeaningfulTempFilePrefix.html' new CLEARGIF: - replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' new COLUMNS: - replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' new CTABLE: - replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' new OTABLE: - replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' new HRULER: - replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content.' + replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json index e40c7dd..ff6e6bd 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff/Expected.json @@ -9,7 +9,7 @@ "line": 2, "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", "severity": 5, - "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "source": "Typo3Update.Removed.TypoScript.styles-insertContent", "type": "WARNING" }, { @@ -18,7 +18,7 @@ "line": 3, "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", "severity": 5, - "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "source": "Typo3Update.Removed.TypoScript.styles-insertContent", "type": "WARNING" }, { @@ -27,7 +27,7 @@ "line": 6, "message": "Legacy calls are not allowed; found styles.insertContent. Removed in 7.0. Either remove usage of styles.insertContent or add a snippet at an early point in TypoScript for backwards compatibility. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-42543-DefaultTypoScriptRemoved.html", "severity": 5, - "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.styles-insertContent", + "source": "Typo3Update.Removed.TypoScript.styles-insertContent", "type": "WARNING" }, { @@ -36,16 +36,61 @@ "line": 13, "message": "Legacy calls are not allowed; found mod.web_list.alternateBgColors. Removed in 7.0. Removed without substitution. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-53658-RemoveAlternateBgColorsOption.html", "severity": 5, - "source": "Typo3Update.Removed.TypoScriptObjectIdentifier.mod-web_list-alternateBgColors", + "source": "Typo3Update.Removed.TypoScript.mod-web_list-alternateBgColors", + "type": "WARNING" + }, + { + "column": 10, + "fixable": false, + "line": 26, + "message": "Legacy calls are not allowed; found CLEARGIF. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScript.CLEARGIF", + "type": "WARNING" + }, + { + "column": 10, + "fixable": false, + "line": 27, + "message": "Legacy calls are not allowed; found COLUMNS. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScript.COLUMNS", + "type": "WARNING" + }, + { + "column": 10, + "fixable": false, + "line": 28, + "message": "Legacy calls are not allowed; found CTABLE. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScript.CTABLE", + "type": "WARNING" + }, + { + "column": 10, + "fixable": false, + "line": 29, + "message": "Legacy calls are not allowed; found OTABLE. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScript.OTABLE", + "type": "WARNING" + }, + { + "column": 10, + "fixable": false, + "line": 30, + "message": "Legacy calls are not allowed; found HRULER. Removed in 7.1. Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScript.HRULER", "type": "WARNING" } ], - "warnings": 4 + "warnings": 9 } }, "totals": { "errors": 0, "fixable": 0, - "warnings": 4 + "warnings": 9 } } From 74eb4dde20fe47813a93b089c657559cba8223b1 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:44:52 +0200 Subject: [PATCH 13/18] TASK: Document yaml structure * To ease contributions and modifications Relates: #54 --- Documentation/source/configuration.rst | 103 +++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 7 deletions(-) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index cd2812d..106ee94 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -1,3 +1,4 @@ +.. _highlight: yaml .. _configuration: Configuration @@ -7,6 +8,13 @@ Configuration is done through PHPCS Standards, e.g. provide a custom :file:`rule project using a :file:`phpcs.xml.dist`. As this is just a PHPCS-Standard, the official documentation applies. +Also some configuration is done through yaml files, see :ref:`configuration-yaml-files`. + +.. _configuration-options: + +Options +------- + All options available in :file:`ruleset.xml` are also available in your :file:`phpcs.xml` files, as already documented by phpcs itself. Therefore this documentation will just mention :file:`ruleset.xml`. @@ -22,7 +30,7 @@ The following configuration options are available: .. _configuration-legacyExtensions: legacyExtensions ----------------- +^^^^^^^^^^^^^^^^ Configures which extension names are legacy. Used to provide further checks and warnings about possible legacy code. All class usages starting with ``Tx_`` where ExtensionName is @@ -44,7 +52,7 @@ Example: .. _configuration-allowedTags: allowedTags ------------ +^^^^^^^^^^^ Only used inside Sniff ``Typo3Update.LegacyClassnames.DocComment``. @@ -66,7 +74,7 @@ Example: .. _configuration-mappingFile: mappingFile ------------ +^^^^^^^^^^^ For auto migrating usages of old class names, a PHP file with a mapping is required. The file has to be in the composer structure :file:`autoload_classaliasmap.php`. @@ -91,7 +99,7 @@ Using ``runtime-set``: .. _configuration-vendor: vendor ------- +^^^^^^ Used while adding namespaces to legacy class definitions and updating plugin and module registrations. Default is ``YourCompany`` to enable you to search and replace afterwards. @@ -115,7 +123,7 @@ Example: .. _configuration-removedFunctionConfigFiles: removedFunctionConfigFiles --------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^ Configure where to look for configuration files defining the removed functions and methods. Default is ``Configuration/Removed/Functions/*.yaml`` inside the standard itself. We already try to deliver @@ -138,7 +146,7 @@ Example: .. _configuration-removedConstantConfigFiles: removedConstantConfigFiles --------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^ Configure where to look for configuration files defining the removed constants. Default is ``Configuration/Removed/Functions/*.yaml`` inside the standard itself. We already try to deliver as @@ -160,7 +168,7 @@ Example: .. _configuration-removedTypoScriptConfigFiles: removedTypoScriptConfigFiles ----------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Configure where to look for configuration files defining the removed TypoScript object identifiers. Default is ``Configuration/Removed/TypoScript/*.yaml`` inside the standard itself. @@ -178,3 +186,84 @@ Example: .. code:: bash --runtime-set removedTypoScriptConfigFiles "/Some/Absolute/Path/*.yaml" + +.. _configuration-yaml-files: + +YAML Files +---------- + +YAML files are used to configure removed constants, function / methods and TypoScript. We decided to +go with yaml files here, to ease adding stuff in the future. It's a simple format and everyone can +contribute. + +You can configure the paths to look up the files through the specific options, documented above. + +This section will cover the structure of the various yaml files. + +General structure +^^^^^^^^^^^^^^^^^ + +The basic structure is the same for all parts. Inside a file you have to provide an array for each +TYPO3 version:: + + '7.0': + styles.insertContent: + replacement: 'Either remove usage of styles.insertContent or a...' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0...' + '7.1': + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->includeTCA: + replacement: 'Full TCA is always loaded during bootstrap in ...' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7...' + +In above example the TypoScript ``styles.insertContent`` was removed in TYPO3 version *7.0*. +Below a TYPO3 version each entry is a removed function or TypoScript part of TYPO3. The key is used +to lookup matchings in the source code. Specific parsing is documented below. + +All entries consists of a ``replacement`` and ``docsUrl`` entry. + +The ``replacement`` can either be ``null`` or a string. If it's null we will show that this part is +removed without any replacement. +If you provide a string, this will be displayed to help during migrations. + +The ``docsUrl`` is displayed in addition, so everyone can take a deeper look at the change, the +effects and how to migrate. + +Also the TYPO3 core team references the forge issues in each change, where you can find the pull +requests. + +Constants and Functions +^^^^^^^^^^^^^^^^^^^^^^^ + +Special parsing is done for the keys identifying removed constants and functions. + +Always provide the fully qualified class namespace. Seperate the constant or method by ``::`` if +it's possible to access it static, otherwise use ``->`` to indicate it's an instance method. + +This is used to check only matching calls. + +Two examples:: + + '7.0': + \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Ch...' + \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->includeTCA: + replacement: 'Full TCA is always loaded during bootstrap in FE, th...' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Change...' + +TypoScript +^^^^^^^^^^ + +Use ``new`` in front of, to declare the entry as OBJECT, e.g. a cObject. +Only matching types will be checked in source code. + +Two examples:: + + '7.0': + styles.insertContent: + replacement: 'Either remove usage of styles.insertContent or add a sni...' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog...' + '7.1': + new HRULER: + replacement: 'Any installation should migrate to alternatives such as F...' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog...' From 5387e553c57ea7bb208f826a2fb5b45a88277d8f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:51:01 +0200 Subject: [PATCH 14/18] TASK: Add remaining TypoScript changes for 7.1 Relates: #54 --- .../Configuration/Removed/TypoScript/7.1.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml index 4433df2..a0079d5 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml @@ -24,3 +24,12 @@ new HRULER: replacement: 'Any installation should migrate to alternatives such as FLUIDTEMPLATE to customize the output of the content' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64639-RemovedContentObjects.html' + new FORM: + replacement: 'For TYPO3 CMS 7, installing EXT:compatibility6 brings back the existing functionality. For the long term the affected installations should migrate to a different, better suited solution for sending mails and building forms' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64668-MailformMovedToLegacyExtension.html' + new IMGTEXT: + replacement: 'Any installation should migrate to alternatives such as CSS Styled Content without a table-based rendering for text w/ image elements to customize the output of content' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64671-ContentObjectImgTextMovedToLegacyExtension.html' + new SEARCHRESULTS: + replacement: 'For TYPO3 CMS 7, installing EXT:compatibility6 brings back the existing functionality. For the long term the affected installations should be migrate to a better suited solution for searching' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Breaking-64696-MoveSearchCTypeToLegacyExtension.html' From 6e602cf5f5e148f987de36e70d6de1b58efcb753 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 16:02:40 +0200 Subject: [PATCH 15/18] TASK: Add all remaining TypoScripts Resolves: #54 --- .../Configuration/Removed/TypoScript/7.1.yaml | 2 +- .../Configuration/Removed/TypoScript/7.2.yaml | 23 +++++++++++++++++++ .../Configuration/Removed/TypoScript/7.4.yaml | 14 +++++++++++ .../Configuration/Removed/TypoScript/7.6.yaml | 5 ++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.2.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.4.yaml create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.6.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml index a0079d5..18d7192 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.1.yaml @@ -1,4 +1,4 @@ -# Breaking changes in 8.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Index.html#breaking-changes +# Breaking changes in 7.1: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.1/Index.html#breaking-changes '7.1': lib.parseFunc_RTE.externalBlocks.blockquote.callRecursive.tagStdWrap.HTMLparser: replacement: 'It is recommended to fix the margins inside your website CSS. Alternatively, you can re-add the above TypoScript lines to your website TypoScript template (not recommended)' diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.2.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.2.yaml new file mode 100644 index 0000000..f1afb7b --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.2.yaml @@ -0,0 +1,23 @@ +# Breaking changes in 7.2: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Index.html#breaking-changes +'7.2': + mod.web_info.menu.function.tx_cms_webinfo_page: + replacement: 'Renamed to mod.web_info.menu.function.TYPO3\CMS\Frontend\Controller\PageInformationController' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_cms_webinfo_lang: + replacement: 'Renamed to mod.web_info.menu.function.TYPO3\CMS\Frontend\Controller\TranslationStatusController' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_belog_webinfo: + replacement: 'Renamed to mod.web_info.menu.function.TYPO3\CMS\Belog\Module\BackendLogModuleBootstrap' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_infopagetsconfig_webinfo: + replacement: 'Renamed to mod.web_info.menu.function.TYPO3\CMS\InfoPagetsconfig\Controller\InfoPageTyposcriptConfigController' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_linkvalidator_ModFuncReport: + replacement: 'Renamed to mod.web_info.menu.function.TYPO3\CMS\Linkvalidator\Report\LinkValidatorReport' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_indexedsearch_modfunc1: + replacement: 'removed, indexed_search has its own module' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' + mod.web_info.menu.function.tx_indexedsearch_modfunc2: + replacement: 'removed, indexed_search has its own module' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.2/Breaking-66286-PageTSconfigOptionsToHideWebInfoModulesRenamed.html' diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.4.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.4.yaml new file mode 100644 index 0000000..a879ace --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.4.yaml @@ -0,0 +1,14 @@ +# Breaking changes in 7.4: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Index.html#breaking-changes +'7.4': + page.javascriptLibs.Prototype: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-39721-PrototypejsAndScriptaculousRemoved.html' + page.javascriptLibs.Scriptaculous: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-39721-PrototypejsAndScriptaculousRemoved.html' + page.javascriptLibs.Scriptaculous.modules: + replacement: ~ + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-39721-PrototypejsAndScriptaculousRemoved.html' + RTE.userLinks: + replacement: 'Use the newly added Tabbing API to add your custom link selection tab' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-68116-DropRTEuserLinksFunctionality.html' diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.6.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.6.yaml new file mode 100644 index 0000000..3396b79 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScript/7.6.yaml @@ -0,0 +1,5 @@ +# Breaking changes in 7.6: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Index.html#breaking-changes +'7.6': + plugin.tx_indexedsearch.settings.showRules: + replacement: 'Use to plugin.tx_indexedsearch.settings.displayRules = 0 instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-51099-StreamlineSettingsConditions.html' From 498e00c6f065ecebb4ff3f949fe2bbe35750ffa1 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 16:05:34 +0200 Subject: [PATCH 16/18] TASK: Add missing phpdoc --- .../Typo3Update/Sniffs/Removed/TypoScriptSniff.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php index f812edb..663ed95 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php @@ -5,8 +5,15 @@ use PHP_CodeSniffer_File as PhpCsFile; use Typo3Update\Sniffs\Options; use Typo3Update\Sniffs\Removed\AbstractGenericUsage; +/** + * Check usage of removed or breaking changed TypoScript. + */ class Typo3Update_Sniffs_Removed_TypoScriptSniff extends AbstractGenericUsage { + /** + * Register sniff only for TypoScript. + * @var array + */ public $supportedTokenizers = [ 'TYPOSCRIPT', ]; From 42e04617bcca3c5656ec1c64a68a72d9b116916f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 16:14:56 +0200 Subject: [PATCH 17/18] BUGFIX: CGL issue * Follow CGL and fix issue. --- src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php index 663ed95..cbf034a 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php @@ -43,7 +43,6 @@ class Typo3Update_Sniffs_Removed_TypoScriptSniff extends AbstractGenericUsage foreach ($typo3Versions as $typo3Version => $removals) { foreach ($removals as $removed => $config) { - $config['type'] = TokenInterface::TYPE_OBJECT_IDENTIFIER; // If starting with new, it's a constructor, meaning content object or other Object. if (strtolower(substr($removed, 0, 4)) === 'new ') { From b502e5292097cea9df3d9bc1d6e1c7eacec9e414 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 25 Apr 2017 08:20:08 +0200 Subject: [PATCH 18/18] TASK: Add missing license * Add license to file. --- .../Sniffs/Removed/TypoScriptSniff.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php index cbf034a..257d5c2 100644 --- a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptSniff.php @@ -1,5 +1,24 @@ + * + * 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 Helmich\TypoScriptParser\Tokenizer\TokenInterface; use PHP_CodeSniffer_File as PhpCsFile; use Typo3Update\Sniffs\Options;