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 + diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index fa5fce1..913b854 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -310,3 +310,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 diff --git a/Documentation/source/features.rst b/Documentation/source/features.rst index 5955b9b..c7bc589 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: @@ -106,6 +106,15 @@ functions. For configuration options see :ref:`configuration-removedConstantConf Check for usage of *removed PHP classes*. The classes are configured in same way as removed functions. For configuration options see :ref:`configuration-removedClassConfigFiles`. +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 -------------- 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) {