diff --git a/composer.json b/composer.json index 2fcca049f..6cbc2098c 100644 --- a/composer.json +++ b/composer.json @@ -135,6 +135,13 @@ }, "require-dev": { "drupal/core-dev": "^11.1", + "phpat/phpat": "^0.10.20", + "phpstan/extension-installer": "^1.4", "weitzman/drupal-test-traits": "^2.5" + }, + "autoload-dev": { + "psr-4": { + "Tools\\": "tools/" + } } } diff --git a/composer.lock b/composer.lock index cd8e4d044..7a066598e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "acf7a5349dc6167b6a9c51b2128cd23f", + "content-hash": "31d8c2ff0a96c6f09d7d1879afc5ad28", "packages": [ { "name": "asm89/stack-cors", @@ -11656,6 +11656,63 @@ }, "time": "2024-03-15T13:55:21+00:00" }, + { + "name": "phpat/phpat", + "version": "0.10.20", + "source": { + "type": "git", + "url": "https://github.com/carlosas/phpat.git", + "reference": "55154db9c36d56aaae5de4bcddb7f5a1202f1910" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/carlosas/phpat/zipball/55154db9c36d56aaae5de4bcddb7f5a1202f1910", + "reference": "55154db9c36d56aaae5de4bcddb7f5a1202f1910", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^1.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "3.46", + "kubawerlos/php-cs-fixer-custom-fixers": "3.18", + "phpunit/phpunit": "^9.0 || ^10.0", + "vimeo/psalm": "^5.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "files": [ + "helpers.php" + ], + "psr-4": { + "PHPat\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carlos Alandete Sastre", + "email": "carlos.alandete@gmail.com" + } + ], + "description": "PHP Architecture Tester", + "support": { + "issues": "https://github.com/carlosas/phpat/issues", + "source": "https://github.com/carlosas/phpat/tree/0.10.20" + }, + "time": "2024-11-23T21:56:24+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6623f9e73..5855cd763 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -3,3 +3,8 @@ parameters: paths: - modules - themes + - tools +services: + - class: Tools\Phpat\ArchitectureTest + tags: + - phpat.test diff --git a/tools/Phpat/ArchitectureTest.php b/tools/Phpat/ArchitectureTest.php new file mode 100644 index 000000000..f276156e2 --- /dev/null +++ b/tools/Phpat/ArchitectureTest.php @@ -0,0 +1,25 @@ +classes( + Selector::inNamespace( + namespace: '/^Drupal\\\\opd_\w+/', + regex: TRUE, + ), + ) + ->excluding(Selector::isInterface()) + ->shouldBeFinal(); + } + +}