From ca4d687155081cda0dd4ca82b4ee3e54a09eb0fe Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 13 Apr 2017 15:22:38 +0200 Subject: [PATCH] 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 +}