From 0e3f487681bbda466bd506b4d60d7a71d283ed9f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:10:28 +0200 Subject: [PATCH 01/11] TASK: Add removed classes in 7.0 Relates: #41 --- .../Configuration/Removed/Classes/7.0.yaml | 45 +++++++++++++++++++ .../Expected.diff | 3 +- .../InputFileForIssues.php | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.0.yaml index 2341204..c50d9c9 100644 --- a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.0.yaml +++ b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.0.yaml @@ -9,3 +9,48 @@ \TYPO3\CMS\Backend\Template\StandardDocumentTemplate: replacement: 'Use \TYPO3\CMS\Backend\Template\DocumentTemplate instead' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-61782-DeprecatedDocumentTemplateClassesRemoved.html' + \TYPO3\CMS\Extbase\Mvc\Controller\ArgumentError: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Mvc\Controller\ArgumentsValidator: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Property\Mapper: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Property\MappingResults: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Security\Channel\RequestHashService: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Validation\PropertyError: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Validation\Validator\AbstractObjectValidator: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Fluid\ViewHelpers\Form\ErrorsViewHelper: + replacement: 'Migrate to rewritten property mapper' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57396-ExtbaseDeprecatedPropertyMapperRemoved.html' + \TYPO3\CMS\Extbase\Mvc\Controller\FlashMessageContainer: + replacement: 'Change the API calls to not be of static kind anymore. Extbase extensions have to use getFlashMessageQueue() of the controllerContext' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-57382-FlashMessageApi.html' + \TYPO3\CMS\Extbase\Service\TypeHandlingService: + replacement: 'Replace all calls to \TYPO3\CMS\Extbase\Service\TypeHandlingService functions to their new static functions in \TYPO3\CMS\Extbase\Utility\TypeHandlingUtility' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-61786-ExtbaseDeprecatedTypeHandlingServiceRemoved.html' + \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface: + replacement: 'Use \TYPO3\CMS\Extbase\Persistence\QueryInterface::*' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html#removed-php-classes' + \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactoryInterface: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62673-ExtbaseDeprecatedCodeRemoved.html#removed-php-classes' + \TYPO3\CMS\Scheduler\Task\FileIndexingTask: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62670-DeprecatedCodeRemovalInMultipleSysexts.html#removed-php-classes' + \TYPO3\CMS\Core\Compatibility\GlobalObjectDeprecationDecorator: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes' + \TYPO3\CMS\Core\Resource\Service\IndexerService: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62416-DeprecatedCodeRemovalInCoreSysext.html#removed-php-classes' diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/Expected.diff index 41f28ef..80accd3 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/Expected.diff +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/Expected.diff @@ -1,10 +1,11 @@ --- tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/InputFileForIssues.php +++ PHP_CodeSniffer -@@ -19,6 +19,6 @@ +@@ -19,7 +19,7 @@ * 02110-1301, USA. */ -t3lib_div::makeInstance('Tx_Extbase_Command_HelpCommandController'); +t3lib_div::makeInstance('\TYPO3\CMS\Extbase\Command\HelpCommandController'); + t3lib_div::makeInstance(\TYPO3\CMS\Core\Resource\Service\IndexerService::class); // Not handled by this sniff, but StaticCallSniff, as this uses double colon. t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class); diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/InputFileForIssues.php index 12550c5..ccc9a0c 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/InputFileForIssues.php +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/InstantiationWithMakeInstanceSniff/InputFileForIssues.php @@ -20,5 +20,6 @@ */ t3lib_div::makeInstance('Tx_Extbase_Command_HelpCommandController'); +t3lib_div::makeInstance(\TYPO3\CMS\Core\Resource\Service\IndexerService::class); // Not handled by this sniff, but StaticCallSniff, as this uses double colon. t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class); From 98b93316521c20a5ca79a343aa3d6435299cba68 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:20:14 +0200 Subject: [PATCH 02/11] TASK: Add removed classes for TYPO3 7.3 Relates: #41 --- .../Configuration/Removed/Classes/7.3.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/Classes/7.3.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.3.yaml b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.3.yaml new file mode 100644 index 0000000..d9fa51d --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.3.yaml @@ -0,0 +1,14 @@ +# Breaking changes in 7.3: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.3/Index.html#breaking-changes +'7.3': + \TYPO3\CMS\T3editor\FormWizard: + replacement: 'Use the newly introduced API' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.3/Breaking-67229-FormEngineRelatedClasses.html' + \TYPO3\CMS\Rtehtmlarea\Controller\FrontendRteController: + replacement: 'Use the newly introduced API' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.3/Breaking-67229-FormEngineRelatedClasses.html' + \TYPO3\CMS\Rsaauth\Hook\LoginFormHook: + replacement: 'Use the new backend login form API' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.3/Breaking-66669-BackendLoginControllerRefactored.html' + \TYPO3\CMS\Extbase\Persistence\Generic\IdentityMap: + replacement: 'Existing code can be migrated to the persistence Session class which provides a drop-in replacement for the IdentityMap' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.3/Breaking-66429-RemoveIdentityMapFromPersistence.html' From 3663af3755e354293d5bfe60d893c19f56d0076a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:33:36 +0200 Subject: [PATCH 03/11] TASK: Add removed classes for TYPO3 7.3 Relates: #41 --- .../Configuration/Removed/Classes/7.4.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/Classes/7.4.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.4.yaml b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.4.yaml new file mode 100644 index 0000000..23c4838 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/Classes/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': + \TYPO3\CMS\Backend\Rte\AbstractRte: + replacement: 'Take a look at the docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-67811-RteApi.html' + \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase: + replacement: 'Take a look at the docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-67811-RteApi.html' + \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi: + replacement: 'Not removed but refactored, see docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-67811-RteApi.html' + \TYPO3\CMS\Backend\Template\FrontendDocumentTemplate: + replacement: null + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.4/Breaking-68243-MoveNotUsedFrontendDocumentTemplate.html' From cfdf58f7d47163af419d0fd6250bf4cc947dffb2 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:33:55 +0200 Subject: [PATCH 04/11] TASK: Add removed classes for TYPO3 7.5 Relates: #41 --- .../Configuration/Removed/Classes/7.5.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/Classes/7.5.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.5.yaml b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.5.yaml new file mode 100644 index 0000000..8fdb755 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.5.yaml @@ -0,0 +1,17 @@ +# Breaking changes in 7.5: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Index.html#breaking-changes +'7.5': + \TYPO3\CMS\Backend\Form\DataPreprocessor: + replacement: 'Take a look at the docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Breaking-69568-FormEngine.html' + \TYPO3\CMS\Backend\Form\FormEngine: + replacement: 'Take a look at the docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Breaking-69568-FormEngine.html' + \TYPO3\CMS\Backend\Form\FlexFormsHelper: + replacement: 'Take a look at the docs' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Breaking-69568-FormEngine.html' + \TYPO3\CMS\Core\Database\SqlParser: + replacement: 'Use \TYPO3\CMS\Dbal\Database\SqlParser instead' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Breaking-68401-SqlParserMovedIntoEXTdbal.html' + \TYPO3\CMS\Cshmanual\Controller\HelpModuleController: + replacement: 'Use the Extbase controller or Repository class' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Breaking-63000-MigrateCshmanualToExtbase.html' From 4fdc15d71532fcd7043b4c207e76f12341c9bd81 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:41:22 +0200 Subject: [PATCH 05/11] TASK: Add removed classes for TYPO3 7.5 Relates: #41 --- .../Configuration/Removed/Classes/7.6.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/Classes/7.6.yaml diff --git a/src/Standards/Typo3Update/Configuration/Removed/Classes/7.6.yaml b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.6.yaml new file mode 100644 index 0000000..4a497e3 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/Classes/7.6.yaml @@ -0,0 +1,23 @@ +# Breaking changes in 7.6: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Index.html#breaking-changes +'7.6': + \TYPO3\CMS\Recordlist\Browser\ElementBrowser: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Rtehtmlarea\BrowseLinks: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Rtehtmlarea\FolderTree: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Rtehtmlarea\LinkHandler\RemoveLinkHandler: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Rtehtmlarea\PageTree: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Core\ElementBrowser\ElementBrowserHookInterface: + replacement: 'Use the new API for adding element browsers or link handlers' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-66369-RemovedElementBrowserRelatedClasses.html' + \TYPO3\CMS\Impexp\ImportExport: + replacement: 'Use or extend one or both of the new classes (TYPO3CMSImpexpImport and TYPO3CMSImpexpExport).' + docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.6/Breaking-45899-SplitClassImportExportIntoClassesImportAndExport.html' From d23bc4d2215fa75500273fd8c266287eabc0b1d5 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 17:05:02 +0200 Subject: [PATCH 06/11] TASK: Add documentation for new feature Relates: #41 --- Documentation/source/configuration.rst | 22 ++++++++++++++++++++++ Documentation/source/features.rst | 11 +++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index 7f8ffc7..fa5fce1 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -165,6 +165,28 @@ Using ``runtime-set``: --runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml" +.. _configuration-removedClassConfigFiles: + +removedClassConfigFiles +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Configure where to look for configuration files defining the removed classes. Default is +``Configuration/Removed/Classes/*.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 + + + +Using ``runtime-set``: + +.. code:: bash + + --runtime-set removedClassConfigFiles "/Some/Absolute/Path/*.yaml" + .. _configuration-removedTypoScriptConfigFiles: removedTypoScriptConfigFiles diff --git a/Documentation/source/features.rst b/Documentation/source/features.rst index e055e92..5955b9b 100644 --- a/Documentation/source/features.rst +++ b/Documentation/source/features.rst @@ -96,13 +96,16 @@ Check for removed calls Also we check for the following deprecated calls: -Check for usage of *removed functions* in general. 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 :ref:`configuration-removedFunctionConfigFiles`. +Check for usage of *removed PHP functions* in general. 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 :ref:`configuration-removedFunctionConfigFiles`. -Check for usage of *removed constants*. The constants are configured in same way as removed +Check for usage of *removed PHP constants*. The constants are configured in same way as removed functions. For configuration options see :ref:`configuration-removedConstantConfigFiles`. +Check for usage of *removed PHP classes*. The classes are configured in same way as removed +functions. For configuration options see :ref:`configuration-removedClassConfigFiles`. + Further checks -------------- From 3fbceb9bbf2c7bb44e7a27e6d56eba5d454ded96 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:45:39 +0200 Subject: [PATCH 07/11] TASK: Add gitlab template for merge requests * To make writing merge requests easier. * Also this should keep them in same structure. --- .gitlab/merge_request_templates/default.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitlab/merge_request_templates/default.md diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md new file mode 100644 index 0000000..67ad892 --- /dev/null +++ b/.gitlab/merge_request_templates/default.md @@ -0,0 +1,6 @@ +* Write some info about what has been done. +* Also don't forget to mention why this has been done, e.g. introduced new + feature? + +Resolves: #IssueNumber + From a0c9df56675606969b542d627428ed469e9fd75a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:54:51 +0200 Subject: [PATCH 08/11] TASK: Document yaml format for features * To enable others to configure their own features. Resolves: #76 --- Documentation/source/configuration.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index 7f8ffc7..effb38b 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -288,3 +288,29 @@ Two examples:: new HRULER: replacement: 'Any installation should migrate to alternatives such as F...' docsUrl: 'https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog...' + +Features +^^^^^^^^ + +Configures which Features should be attached to x Sniffs, where Key is the FQCN of the feature and +the values are FQCN of the sniffs. + +Works only if the sniff respects execution of features. + +One example:: + + Typo3Update\Feature\LegacyClassnameFeature: + - Typo3Update_Sniffs_Classname_InheritanceSniff + - Typo3Update_Sniffs_Classname_InlineCommentSniff + - Typo3Update_Sniffs_Classname_InstanceofSniff + - Typo3Update_Sniffs_Classname_InstantiationWithMakeInstanceSniff + - Typo3Update_Sniffs_Classname_InstantiationWithNewSniff + - Typo3Update_Sniffs_Classname_InstantiationWithObjectManagerSniff + - Typo3Update_Sniffs_Classname_IsACallSniff + - Typo3Update_Sniffs_Classname_MissingVendorForPluginsAndModulesSniff + - Typo3Update_Sniffs_Classname_PhpDocCommentSniff + - Typo3Update_Sniffs_Classname_StaticCallSniff + - Typo3Update_Sniffs_Classname_TypeHintCatchExceptionSniff + - Typo3Update_Sniffs_Classname_TypeHintSniff + - Typo3Update_Sniffs_Classname_UseSniff + - Typo3Update_Sniffs_LegacyClassname_MissingNamespaceSniff From a84f164c49096e6f790f0267b9c347c385b07a15 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 17:01:06 +0200 Subject: [PATCH 09/11] TASK: Fix typo --- Documentation/source/features.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/source/features.rst b/Documentation/source/features.rst index e055e92..2ae12ad 100644 --- a/Documentation/source/features.rst +++ b/Documentation/source/features.rst @@ -15,7 +15,7 @@ Possible configurations for all sniffs: Implemented sniffs: -- PHPDocuments, like Includes and annotations for IDEs. +- PHPDocComments, like Includes and annotations for IDEs. Possible extra configurations: From 582ede251381a7600748974bce3b3bb8762a828f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 17:01:30 +0200 Subject: [PATCH 10/11] TASK: Add removed TypoScript feature to docs --- Documentation/source/features.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/source/features.rst b/Documentation/source/features.rst index 2ae12ad..51c8910 100644 --- a/Documentation/source/features.rst +++ b/Documentation/source/features.rst @@ -103,6 +103,15 @@ information. For configuration options see :ref:`configuration-removedFunctionCo Check for usage of *removed constants*. The constants are configured in same way as removed functions. For configuration options see :ref:`configuration-removedConstantConfigFiles`. +Check for usage of *removed TypoScript*. The TypoScript objects are configured in same way as +removed functions. For configuration options see :ref:`configuration-removedTypoScriptConfigFiles`. +This will check whether you are using already removed TypoScript parts, supported are: + +- Objects, e.g. ``CLEARGIF``, ``FORM`` + +- Paths like ``styles.insertContent`` + +For a complete list, take a look at the corresponding YAML-Files. Further checks -------------- From 299c33a075f09d539d7e6cad001cfa94f5609f72 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 2 May 2017 12:44:04 +0200 Subject: [PATCH 11/11] FEATURE: Add warning for removed TypoScript Constants * Configure removed constants in TYPO3 7.x. * Add code / sniff. * Add test. * Update docs. Resolves: #74 --- Documentation/source/configuration.rst | 22 +++++ Documentation/source/features.rst | 4 + .../Removed/TypoScriptConstant/7.0.yaml | 20 +++++ src/Standards/Typo3Update/Options.php | 13 +++ .../Removed/TypoScriptConstantSniff.php | 86 +++++++++++++++++++ .../TypoScriptConstantSniff/Expected.json | 42 +++++++++ .../InputFileForIssues.ts | 8 ++ 7 files changed, 195 insertions(+) create mode 100644 src/Standards/Typo3Update/Configuration/Removed/TypoScriptConstant/7.0.yaml create mode 100644 src/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff.php create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/Expected.json create mode 100644 tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/InputFileForIssues.ts diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index effb38b..ce735c6 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -187,6 +187,28 @@ Using ``runtime-set``: --runtime-set removedTypoScriptConfigFiles "/Some/Absolute/Path/*.yaml" +.. _configuration-removedTypoScriptConstantConfigFiles: + +removedTypoScriptConstantsConfigFiles +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Configure where to look for configuration files defining the removed TypoScript constants. +Default is ``Configuration/Removed/TypoScriptConstants/*.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 + + + +Using ``runtime-set``: + +.. code:: bash + + --runtime-set removedTypoScriptConstantConfigFiles "/Some/Absolute/Path/*.yaml" + .. _configuration-features: features diff --git a/Documentation/source/features.rst b/Documentation/source/features.rst index 51c8910..648e91b 100644 --- a/Documentation/source/features.rst +++ b/Documentation/source/features.rst @@ -111,6 +111,10 @@ This will check whether you are using already removed TypoScript parts, supporte - Paths like ``styles.insertContent`` +Check for usage of *removed TypoScript constants*. The TypoScript constants are configured in same +way as removed functions. For configuration options see +:ref:`configuration-removedTypoScriptConstantConfigFiles`. + For a complete list, take a look at the corresponding YAML-Files. Further checks diff --git a/src/Standards/Typo3Update/Configuration/Removed/TypoScriptConstant/7.0.yaml b/src/Standards/Typo3Update/Configuration/Removed/TypoScriptConstant/7.0.yaml new file mode 100644 index 0000000..80d7e28 --- /dev/null +++ b/src/Standards/Typo3Update/Configuration/Removed/TypoScriptConstant/7.0.yaml @@ -0,0 +1,20 @@ +# Breaking changes in 7.0: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Index.html#breaking-changes +'7.0': + _clear: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' + _blackBorderWrap: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' + _tableWrap: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' + _tableWrap_DEBUG: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' + _stdFrameParams: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' + _stdFramesetParams: + replacement: 'Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html' diff --git a/src/Standards/Typo3Update/Options.php b/src/Standards/Typo3Update/Options.php index 62b8a78..f5a4777 100644 --- a/src/Standards/Typo3Update/Options.php +++ b/src/Standards/Typo3Update/Options.php @@ -95,6 +95,19 @@ class Options ); } + /** + * Returns an array of absolute file names containing removed typoscript constants. + * + * @return array + */ + public static function getRemovedTypoScriptConstantConfigFiles() + { + return static::getOptionFileNames( + 'removedTypoScriptConstant', + __DIR__ . '/Configuration/Removed/TypoScriptConstant/*.yaml' + ); + } + /** * Returns an array of absolute file names containing removed class configurations. * diff --git a/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff.php b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff.php new file mode 100644 index 0000000..c396d32 --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff.php @@ -0,0 +1,86 @@ + + * + * 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\Options; +use Typo3Update\Sniffs\Removed\AbstractGenericUsage; + +class Typo3Update_Sniffs_Removed_TypoScriptConstantSniff extends AbstractGenericUsage +{ + /** + * Register sniff only for TypoScript. + * @var array + */ + public $supportedTokenizers = [ + 'TYPOSCRIPT', + ]; + + public function register() + { + return [ + TokenInterface::TYPE_RIGHTVALUE_MULTILINE, + TokenInterface::TYPE_RIGHTVALUE, + ]; + } + + protected function prepareStructure(array $typo3Versions) + { + $newStructure = []; + + foreach ($typo3Versions as $typo3Version => $removals) { + foreach ($removals as $removed => $config) { + $config['name'] = $removed; + $config['identifier'] = $removed; + $config['oldUsage'] = $removed; + $config['versionRemoved'] = $typo3Version; + $newStructure[$removed] = $config; + } + } + + return $newStructure; + } + + protected function findRemoved(PhpCsFile $phpcsFile, $stackPtr) + { + $removed = []; + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + $matches = []; + preg_match_all('/\{\$.*\}/', $token['content'], $matches); + + foreach ($matches as $constants) { + foreach ($constants as $constant) { + $constant = substr($constant, 2, -1); + if ($this->configured->isRemoved($constant)) { + $removed[] = $this->configured->getRemoved($constant); + } + } + } + + return $removed; + } + + protected function getRemovedConfigFiles() + { + return Options::getRemovedTypoScriptConstantConfigFiles(); + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/Expected.json new file mode 100644 index 0000000..e353a62 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/Expected.json @@ -0,0 +1,42 @@ +{ + "files": { + "InputFileForIssues.ts": { + "errors": 0, + "messages": [ + { + "column": 13, + "fixable": false, + "line": 3, + "message": "Calls to removed code are not allowed; found _clear. Removed in 7.0. Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptConstant._clear", + "type": "WARNING" + }, + { + "column": 11, + "fixable": false, + "line": 4, + "message": "Calls to removed code are not allowed; found _tableWrap_DEBUG. Removed in 7.0. Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptConstant._tableWrap_DEBUG", + "type": "WARNING" + }, + { + "column": 11, + "fixable": false, + "line": 4, + "message": "Calls to removed code are not allowed; found _tableWrap. Removed in 7.0. Either remove usage of constant 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-60561-DefaultTypoScriptConstantsRemoved.html", + "severity": 5, + "source": "Typo3Update.Removed.TypoScriptConstant._tableWrap", + "type": "WARNING" + } + ], + "warnings": 3 + } + }, + "totals": { + "errors": 0, + "fixable": 0, + "warnings": 3 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/InputFileForIssues.ts b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/InputFileForIssues.ts new file mode 100644 index 0000000..e8cc475 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/TypoScriptConstantSniff/InputFileForIssues.ts @@ -0,0 +1,8 @@ +test = TEXT +test { + value = Some stuff {$_clear} and some more. + value ( + Some values {$_tableWrap_DEBUG} + {$_tableWrap} + ) +}