From 2dd0b30759f8d0254de7c94a12b7e8ccba5d3bc0 Mon Sep 17 00:00:00 2001 From: Rutger Rademaker Date: Tue, 7 Jul 2026 16:01:55 +0200 Subject: [PATCH 1/5] chore: allow for codesniffer ^4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9b06d8f..7d68d62 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "phpmd/phpmd": "^2.15 || 3.x-dev", "phpro/grumphp-shim": "^2.15", "phpstan/phpstan": "@stable", - "squizlabs/php_codesniffer": "^3.12.0", + "squizlabs/php_codesniffer": "^3.12.0 || ^4.0", "youwe/composer-dependency-installer": "^2.0", "youwe/composer-file-installer": "^2.0.0" }, From 8805e404a43b1fb993c78e9d6060b08ed97cb665 Mon Sep 17 00:00:00 2001 From: Rutger Rademaker Date: Tue, 7 Jul 2026 16:28:21 +0200 Subject: [PATCH 2/5] chore: Make sure we pass our own phpcs rules --- templates/files/pimcore/.php-cs-fixer.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/templates/files/pimcore/.php-cs-fixer.php b/templates/files/pimcore/.php-cs-fixer.php index 3f871b1..a54d741 100644 --- a/templates/files/pimcore/.php-cs-fixer.php +++ b/templates/files/pimcore/.php-cs-fixer.php @@ -1,12 +1,18 @@ in(__DIR__) ->exclude([ ...require(__DIR__ . '/vendor/youwe/testing-suite/config/pimcore/php-cs-fixer/excludes.php'), @@ -18,14 +24,14 @@ // example: 'autogenerated_content', ]); -$config = new PhpCsFixer\Config(); // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) -return $config // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) +$config = new PhpCsFixer\Config(); // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) +return $config // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) ->setRules(array_merge_recursive( require(__DIR__ . '/vendor/youwe/testing-suite/config/pimcore/php-cs-fixer/rules.php'), [ /** * Add your application specific overrides here - * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst for available rule sets + * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst for ruleSets * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst for individual rules */ From e21f72ae0768ac687e51ebc6dbc0173e558d9490 Mon Sep 17 00:00:00 2001 From: Rutger Rademaker Date: Tue, 7 Jul 2026 16:38:55 +0200 Subject: [PATCH 3/5] chore: add mising mapping --- templates/mapping/project/drupal | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 templates/mapping/project/drupal diff --git a/templates/mapping/project/drupal b/templates/mapping/project/drupal new file mode 100644 index 0000000..04763af --- /dev/null +++ b/templates/mapping/project/drupal @@ -0,0 +1,4 @@ +{drupal/,}grumphp.yml +{drupal/,}phpcs.xml +{drupal/,}phpmd.xml +{drupal/,}phpstan.neon From 7901a43e8a85020d6d71d285dc5128f56f82ced3 Mon Sep 17 00:00:00 2001 From: Rutger Rademaker Date: Tue, 7 Jul 2026 16:53:55 +0200 Subject: [PATCH 4/5] chore: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a26e5f..fdbeeca 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The Youwe Testing Suites offers pre-configured standards for the following proje | Testing Suite Project Type | Detected based on Composer Project Type | |----------------------------|----------------------------------------------------------------------------| -| `drupal` | `drupal-bundle`, `drupal-project` | +| `drupal` | `drupal-module`, `drupal-project` | | `magento2` | `magento-module`, `magento-project`, `magento2-module`, `magento2-project` | | `pimcore` | `pimcore-bundle`, `pimcore-project` | | `default` | Any other | From 8f6bcebfa22e25ab9de94b771c1ef224c4beb3e2 Mon Sep 17 00:00:00 2001 From: Rutger Rademaker Date: Mon, 24 Aug 2026 09:15:50 +0200 Subject: [PATCH 5/5] chore: update with master branch --- CHANGELOG.md | 18 +++++++++++++++ config/drupal/grumphp.yml | 8 +++++++ src/Installer/PackagesInstaller.php | 27 +++++++++++++++++++++++ src/ProjectTypeResolver.php | 2 +- templates/files/drupal/phpcs.xml | 2 +- templates/files/pimcore/.php-cs-fixer.php | 16 +++++--------- tests/ProjectTypeResolverTest.php | 2 +- 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cea8f05..8ff1757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.2.0] +### Added +- Added coding standards for `drupal`. +- Added packages for `phpstan` for drupal based on [this documentation](https://www.drupal.org/docs/develop/development-tools/phpstan/getting-startedhttps://www.drupal.org/docs/develop/development-tools/phpstan/getting-started) + - `phpstan/phpstan` + - `phpstan/extension-installer` + - `mglaman/phpstan-drupal` + - `phpstan/phpstan-deprecation-rules` +- Added package for `phpcs` based on (this documentation)[https://www.drupal.org/docs/extending-drupal/contributed-modules/contributed-module-documentation/coder/installing-coder] + - `drupal/coder` + +### Fixed +- Mapping for drupal was added to prevent error that file is missing in `templates/mapping/project/drupal`. + +### Changed +- Allow `squizlabs/php_codesniffer` to be installed in a project with version `4.x` or higher, since the `drupal/coder` package requires this. + ## [3.1.2] ### Fixed - `Failed to locate the main schema resource at 'https://pmd.sourceforge.io/ruleset_xml_schema.xsd'` for php 8.3 and 8.4) @@ -33,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added exclude for UnusedFormalParameter to allow unused parameters in a function - Added exception for short variable name for $id - PHPCS Excluded Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation + ### Fixed - Updated property for LongVariable did not work. diff --git a/config/drupal/grumphp.yml b/config/drupal/grumphp.yml index 3964359..824613c 100644 --- a/config/drupal/grumphp.yml +++ b/config/drupal/grumphp.yml @@ -8,3 +8,11 @@ parameters: # securitychecker.allow_list: # - CVE-2002-0121 # Add a jira ticket indicating when this vulnerability will be fixed (update/upgrade will be # performed). Within that ticket explain this (new) vulnerability. + +grumphp: + tasks: + phpcs: + ignore_patterns: + - /^build\// + - /^drush\// + - /^\.ddev\// \ No newline at end of file diff --git a/src/Installer/PackagesInstaller.php b/src/Installer/PackagesInstaller.php index b910629..4bdcc87 100644 --- a/src/Installer/PackagesInstaller.php +++ b/src/Installer/PackagesInstaller.php @@ -55,6 +55,33 @@ class PackagesInstaller implements InstallerInterface 'updateDependencies' => true, ] ], + 'drupal' => [ + 'drupal/coder' => [ + 'version' => '@stable', + 'updateDependencies' => true, + 'allowVersionOverride' => false, + ], + 'phpstan/phpstan' => [ + 'version' => '@stable', + 'updateDependencies' => true, + 'allowVersionOverride' => false, + ], + 'phpstan/extension-installer' => [ + 'version' => '@stable', + 'updateDependencies' => true, + 'allowVersionOverride' => false, + ], + 'mglaman/phpstan-drupal' => [ + 'version' => '@stable', + 'updateDependencies' => true, + 'allowVersionOverride' => false, + ], + 'phpstan/phpstan-deprecation-rules' => [ + 'version' => '@stable', + 'updateDependencies' => true, + 'allowVersionOverride' => false, + ], + ], 'pimcore' => [ 'phpstan/phpstan' => [ 'version' => '>=2.0', diff --git a/src/ProjectTypeResolver.php b/src/ProjectTypeResolver.php index 9711ae0..f7b1063 100644 --- a/src/ProjectTypeResolver.php +++ b/src/ProjectTypeResolver.php @@ -31,7 +31,7 @@ class ProjectTypeResolver /** @var array */ private $mapping = [ - 'drupal-bundle' => 'drupal', + 'drupal-module' => 'drupal', 'drupal-project' => 'drupal', 'magento-project' => 'magento2', 'magento2-module' => 'magento2', diff --git a/templates/files/drupal/phpcs.xml b/templates/files/drupal/phpcs.xml index a30dea4..7508902 100644 --- a/templates/files/drupal/phpcs.xml +++ b/templates/files/drupal/phpcs.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> PHPCS - + diff --git a/templates/files/pimcore/.php-cs-fixer.php b/templates/files/pimcore/.php-cs-fixer.php index a54d741..3f871b1 100644 --- a/templates/files/pimcore/.php-cs-fixer.php +++ b/templates/files/pimcore/.php-cs-fixer.php @@ -1,18 +1,12 @@ in(__DIR__) ->exclude([ ...require(__DIR__ . '/vendor/youwe/testing-suite/config/pimcore/php-cs-fixer/excludes.php'), @@ -24,14 +18,14 @@ // example: 'autogenerated_content', ]); -$config = new PhpCsFixer\Config(); // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) -return $config // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) +$config = new PhpCsFixer\Config(); // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) +return $config // @phpstan-ignore class.notFound (class lives in phar file and can't be seen) ->setRules(array_merge_recursive( require(__DIR__ . '/vendor/youwe/testing-suite/config/pimcore/php-cs-fixer/rules.php'), [ /** * Add your application specific overrides here - * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst for ruleSets + * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst for available rule sets * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst for individual rules */ diff --git a/tests/ProjectTypeResolverTest.php b/tests/ProjectTypeResolverTest.php index b2f9287..90352e0 100644 --- a/tests/ProjectTypeResolverTest.php +++ b/tests/ProjectTypeResolverTest.php @@ -26,7 +26,7 @@ class ProjectTypeResolverTest extends TestCase * @throws Exception */ #[TestWith(data: ['some-type', 'default'], name: 'some-type')] - #[TestWith(data: ['drupal-bundle', 'drupal'], name: 'drupal-bundle')] + #[TestWith(data: ['drupal-module', 'drupal'], name: 'drupal-bundle')] #[TestWith(data: ['drupal-project', 'drupal'], name: 'drupal-project')] #[TestWith(data: ['magento-project', 'magento2'], name: 'magento-project')] #[TestWith(data: ['magento2-module', 'magento2'], name: 'magento2-module')]