From 8781a8e715b1cc157d677e6509be44d189ec272d Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:45:39 +0200 Subject: [PATCH 1/5] 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 380398a0afeea1271060e411d48700ddb5a3d877 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 16:54:51 +0200 Subject: [PATCH 2/5] 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 28d6e875d243f0a8b2eb23df6bbdc3573051bac1 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 17:01:06 +0200 Subject: [PATCH 3/5] 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 06e0578df28bfe373e662d1f16755d502e4a4d8a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 27 Apr 2017 17:01:30 +0200 Subject: [PATCH 4/5] 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 9e3f7ac1e507713d021c39967428dabb58c2dc59 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 2 May 2017 08:09:10 +0200 Subject: [PATCH 5/5] TASK: Fix MR issues * Remove construct from interface. * Fix wrong type hints. * Keep naming of variable in sync. * Also keep conditions format in sync. Relates: #71 --- .../Typo3Update/AbstractYamlRemovedUsage.php | 16 ++++++++-------- .../Typo3Update/Feature/FeatureInterface.php | 5 ----- .../Typo3Update/Feature/RemovedClassFeature.php | 2 +- .../Typo3Update/RemovedByYamlConfiguration.php | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Standards/Typo3Update/AbstractYamlRemovedUsage.php b/src/Standards/Typo3Update/AbstractYamlRemovedUsage.php index 37d1c4e..e753605 100644 --- a/src/Standards/Typo3Update/AbstractYamlRemovedUsage.php +++ b/src/Standards/Typo3Update/AbstractYamlRemovedUsage.php @@ -29,7 +29,7 @@ use Typo3Update\RemovedByYamlConfiguration; abstract class AbstractYamlRemovedUsage { /** - * @var array + * @var RemovedByYamlConfiguration */ protected $configured; @@ -65,19 +65,19 @@ abstract class AbstractYamlRemovedUsage /** * @param PhpCsFile $phpcsFile * @param int $stackPtr - * @param array $removed + * @param array $config */ - protected function addWarning(PhpCsFile $phpcsFile, $stackPtr, array $removed) + protected function addWarning(PhpCsFile $phpcsFile, $stackPtr, array $config) { $phpcsFile->addWarning( 'Calls to removed code are not allowed; found %s. Removed in %s. %s. See: %s', $stackPtr, - $removed['identifier'], + $config['identifier'], [ - $removed['oldUsage'], - $removed['versionRemoved'], - $this->getReplacement($removed), - $removed['docsUrl'], + $config['oldUsage'], + $config['versionRemoved'], + $this->getReplacement($config), + $config['docsUrl'], ] ); } diff --git a/src/Standards/Typo3Update/Feature/FeatureInterface.php b/src/Standards/Typo3Update/Feature/FeatureInterface.php index ac8b7a9..8ab83a7 100644 --- a/src/Standards/Typo3Update/Feature/FeatureInterface.php +++ b/src/Standards/Typo3Update/Feature/FeatureInterface.php @@ -28,11 +28,6 @@ use PHP_CodeSniffer_Sniff as PhpCsSniff; */ interface FeatureInterface { - /** - * @var PhpCsSniff $sniff - */ - public function __construct(PhpCsSniff $sniff); - /** * Process like a PHPCS Sniff. * diff --git a/src/Standards/Typo3Update/Feature/RemovedClassFeature.php b/src/Standards/Typo3Update/Feature/RemovedClassFeature.php index ffc61df..5584dfc 100644 --- a/src/Standards/Typo3Update/Feature/RemovedClassFeature.php +++ b/src/Standards/Typo3Update/Feature/RemovedClassFeature.php @@ -27,7 +27,7 @@ class RemovedClassFeature extends AbstractYamlRemovedUsage { public function process(PhpCsFile $phpcsFile, $classnamePosition, $classname) { - if (! $this->configured->isRemoved($classname)) { + if ($this->configured->isRemoved($classname) === false) { return; } $this->addWarning( diff --git a/src/Standards/Typo3Update/RemovedByYamlConfiguration.php b/src/Standards/Typo3Update/RemovedByYamlConfiguration.php index f1596a9..046c180 100644 --- a/src/Standards/Typo3Update/RemovedByYamlConfiguration.php +++ b/src/Standards/Typo3Update/RemovedByYamlConfiguration.php @@ -33,7 +33,7 @@ class RemovedByYamlConfiguration /** * @param array $configFiles - * @param Callable $prepareStructure + * @param \Callable $prepareStructure */ public function __construct(array $configFiles, $prepareStructure) {