From eb50da5e11405c5e143655a4387842e534720942 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 10 Sep 2026 09:36:18 +0700 Subject: [PATCH 01/10] Use StructArmed on QA --- .gitattributes | 1 + .github/workflows/continuous-integration.yml | 35 +++ composer.json | 3 +- composer.lock | 211 +++++++++++++++++- structarmed.php | 54 +++++ ...mentedBecauseItTriggersAutoloadingTest.php | 2 +- .../ReflectionAttributeHelperTest.php | 2 +- .../Ast/Exception/ParseToAstFailureTest.php | 3 +- .../Ast/FindReflectionsInTreeTest.php | 2 +- test/unit/SourceLocator/Ast/LocatorTest.php | 2 +- .../Ast/Parser/MemoizingParserTest.php | 2 +- .../Ast/Strategy/NodeToReflectionTest.php | 2 +- .../Exception/InvalidPrefixMappingTest.php | 2 +- 13 files changed, 311 insertions(+), 10 deletions(-) create mode 100644 structarmed.php diff --git a/.gitattributes b/.gitattributes index efaa1f682..2acb5e51e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,5 +15,6 @@ /psalm.xml export-ignore /psalm-baseline.xml export-ignore /renovate.json export-ignore +/structarmed.php export-ignore /tools/ export-ignore /test/ export-ignore diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0ed531201..72bccb51a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -141,6 +141,41 @@ jobs: - name: "psalm" run: "tools/vendor/bin/psalm --shepherd --stats" + static-analysis-structarmed: + name: "Static Analysis by StructArmed" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "locked" + php-version: + - "8.4" + - "8.5" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1" # v7 + + - name: "Install PHP" + uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2 + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + extensions: intl, sodium + ini-values: memory_limit=-1 + + - name: "Install dependencies" + uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0 + with: + dependency-versions: "${{ matrix.dependencies }}" + + - name: "StructArmed" + run: "vendor/bin/structarmed analyze" + mutation-tests: name: "Mutation tests" diff --git a/composer.json b/composer.json index f3d754fb1..78428f9f8 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ ], "require-dev": { "phpbench/phpbench": "^1.7.0", - "phpunit/phpunit": "^13.4.3" + "phpunit/phpunit": "^13.4.3", + "boundwize/structarmed": "^0.17.2" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index f7c7c3b9e..9903bddd5 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": "a3ff4fe42b74f4060727201ae806a6f9", + "content-hash": "0c9501bc15028f833c91ae07ac69efe9", "packages": [ { "name": "jetbrains/phpstorm-stubs", @@ -109,6 +109,153 @@ } ], "packages-dev": [ + { + "name": "boundwize/jsonrecast", + "version": "1.0.37", + "source": { + "type": "git", + "url": "https://github.com/boundwize/jsonrecast.git", + "reference": "d37e0d808cd5c0a8f6e5d6f36ea363202950e399" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/boundwize/jsonrecast/zipball/d37e0d808cd5c0a8f6e5d6f36ea363202950e399", + "reference": "d37e0d808cd5c0a8f6e5d6f36ea363202950e399", + "shasum": "" + }, + "require": { + "php": "^8.2" + }, + "require-dev": { + "boundwize/pyrameter": "^0.5", + "boundwize/structarmed": "^0.19", + "laminas/laminas-coding-standard": "^3.1", + "phpstan/phpstan": "^2.2", + "phpunit/phpunit": "^11.5", + "rector/rector": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Boundwize\\JsonRecast\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Abdul Malik Ikhsan", + "email": "samsonasik@gmail.com", + "homepage": "http://samsonasik.wordpress.com", + "role": "Developer" + } + ], + "description": "Editable JSON AST with visitor traversal and formatting-preserving printing.", + "homepage": "https://github.com/boundwize/jsonrecast", + "keywords": [ + "ast", + "formatting", + "json", + "parser", + "refactoring" + ], + "support": { + "issues": "https://github.com/boundwize/jsonrecast/issues", + "source": "https://github.com/boundwize/jsonrecast/tree/1.0.37" + }, + "funding": [ + { + "url": "https://github.com/samsonasik", + "type": "github" + } + ], + "time": "2026-10-10T08:53:11+00:00" + }, + { + "name": "boundwize/structarmed", + "version": "0.17.12", + "source": { + "type": "git", + "url": "https://github.com/boundwize/structarmed.git", + "reference": "05a625da831db09d581f37357682d6cbce4db603" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/boundwize/structarmed/zipball/05a625da831db09d581f37357682d6cbce4db603", + "reference": "05a625da831db09d581f37357682d6cbce4db603", + "shasum": "" + }, + "require": { + "boundwize/jsonrecast": "^1.0", + "composer-runtime-api": "^2.0", + "fidry/cpu-core-counter": "^1.3", + "nikic/php-parser": "^5.8", + "php": "^8.2" + }, + "require-dev": { + "boundwize/pyrameter": "^0.5", + "laminas/laminas-coding-standard": "^3.1", + "phpstan/phpstan": "^2.2", + "phpunit/phpunit": "^11.5", + "rector/rector": "dev-main" + }, + "bin": [ + "bin/structarmed" + ], + "type": "library", + "autoload": { + "psr-4": { + "Boundwize\\StructArmed\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Abdul Malik Ikhsan", + "email": "samsonasik@gmail.com", + "homepage": "http://samsonasik.wordpress.com", + "role": "Developer" + } + ], + "description": "Configurable PHP architecture guards — define your layers and rules, then keep them enforced", + "homepage": "https://github.com/boundwize/structarmed", + "keywords": [ + "Enforcement", + "analysis", + "architecture", + "ddd", + "dev", + "layer", + "mvc", + "psr1", + "psr12", + "psr15", + "psr4", + "static analysis", + "yagni" + ], + "support": { + "issues": "https://github.com/boundwize/structarmed/issues", + "source": "https://github.com/boundwize/structarmed/tree/0.17.12" + }, + "funding": [ + { + "url": "https://github.com/samsonasik", + "type": "github" + } + ], + "time": "2026-09-20T13:16:10+00:00" + }, { "name": "doctrine/annotations", "version": "2.0.2", @@ -261,6 +408,68 @@ ], "time": "2026-10-01T06:59:29+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "d384a7d0d6e67aa497327260ca95023e92dc2032" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/d384a7d0d6e67aa497327260ca95023e92dc2032", + "reference": "d384a7d0d6e67aa497327260ca95023e92dc2032", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0 || ^1.1.2", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "symfony/polyfill-mbstring": "^1.33", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.4.1" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2026-09-29T22:11:39+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.14.0", diff --git a/structarmed.php b/structarmed.php new file mode 100644 index 000000000..3f5176511 --- /dev/null +++ b/structarmed.php @@ -0,0 +1,54 @@ +skip([ + __DIR__ . '/test/unit/Fixture', + ]) + ->withPreset(Preset::PSR4()) + ->layerPattern('Facade', '/^Roave\\\\BetterReflection\\\\BetterReflection$/') + ->layerPattern('Identifier', '/^Roave\\\\BetterReflection\\\\Identifier\\\\.*$/') + ->layerPattern('NodeCompiler', '/^Roave\\\\BetterReflection\\\\NodeCompiler\\\\.*$/') + ->layerPattern( + 'Reflection', + '/^Roave\\\\BetterReflection\\\\Reflection\\\\.*$/', + '/^Roave\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\.*$/' + ) + ->layerPattern('ReflectionAdapter', '/^Roave\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\.*$/') + ->layerPattern('Reflector', '/^Roave\\\\BetterReflection\\\\Reflector\\\\.*$/') + ->layerPattern( + 'SourceLocator', + [ + '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\FileChecker$/', + '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Exception\\\\.*$/', + ] + ) + ->layerPattern('SourceLocatorAst', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Ast\\\\.*$/') + ->layerPattern('Located', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Located\\\\.*$/') + ->layerPattern('SourceStubber', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\SourceStubber\\\\.*$/') + ->layerPattern( + 'SourceLocatorType', + '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\.*$/', + '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/' + ) + ->layerPattern('Composer', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/') + ->layerPattern('Util', '/^Roave\\\\BetterReflection\\\\Util\\\\.*$/') + ->ruleset([ + 'Facade' => ['+SourceLocatorType'], + 'Identifier' => ['Reflection'], + 'NodeCompiler' => ['Reflection', 'Reflector', 'Util'], + 'Reflection' => ['+NodeCompiler', 'ReflectionAdapter', 'Facade', 'Located', 'SourceLocatorType'], + 'ReflectionAdapter' => ['Reflection', 'Reflector', 'Util'], + 'Reflector' => ['Identifier', 'Reflection', 'SourceLocatorType'], + 'SourceLocator' => [], + 'SourceLocatorAst' => ['+Reflector', 'Located', 'Util'], + 'Located' => ['SourceLocator', 'Util'], + 'SourceStubber' => ['Reflection', 'SourceLocator', 'Util'], + 'SourceLocatorType' => ['+SourceLocatorAst', 'Facade', 'SourceLocator', 'SourceStubber', 'Util'], + 'Composer' => ['+SourceLocatorType'], + 'Util' => ['+SourceLocatorAst', 'SourceLocator', 'SourceLocatorType'], + ]); diff --git a/test/unit/Reflection/Adapter/Exception/NotImplementedBecauseItTriggersAutoloadingTest.php b/test/unit/Reflection/Adapter/Exception/NotImplementedBecauseItTriggersAutoloadingTest.php index 86cc229a0..d78f266e6 100644 --- a/test/unit/Reflection/Adapter/Exception/NotImplementedBecauseItTriggersAutoloadingTest.php +++ b/test/unit/Reflection/Adapter/Exception/NotImplementedBecauseItTriggersAutoloadingTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflection\Adapter; +namespace Roave\BetterReflectionTest\Reflection\Adapter\Exception; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; diff --git a/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php b/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php index a0a1206df..31ea49ca8 100644 --- a/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php +++ b/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflection; +namespace Roave\BetterReflectionTest\Reflection\Attribute; use PhpParser\Node; use PHPUnit\Framework\Attributes\CoversClass; diff --git a/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php b/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php index 3baf3fa4b..85d7d7285 100644 --- a/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php +++ b/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Roave\BetterReflection\SourceLocator\Ast\Exception; +namespace Roave\BetterReflectionTest\SourceLocator\Ast\Exception; use Exception; use PhpParser\Error; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use ReflectionProperty; +use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; #[CoversClass(ParseToAstFailure::class)] diff --git a/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php b/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php index 26b40e141..759d00119 100644 --- a/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php +++ b/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflector; +namespace Roave\BetterReflectionTest\SourceLocator\Ast; use PhpParser\Node; use PHPUnit\Framework\Attributes\CoversClass; diff --git a/test/unit/SourceLocator/Ast/LocatorTest.php b/test/unit/SourceLocator/Ast/LocatorTest.php index fc5c05929..f40e6def4 100644 --- a/test/unit/SourceLocator/Ast/LocatorTest.php +++ b/test/unit/SourceLocator/Ast/LocatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflector; +namespace Roave\BetterReflectionTest\SourceLocator\Ast; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; diff --git a/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php b/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php index 283cd4617..aaf5a03ab 100644 --- a/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php +++ b/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflector; +namespace Roave\BetterReflectionTest\SourceLocator\Ast\Parser; use PhpParser\Node; use PhpParser\Node\Name; diff --git a/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php b/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php index 590e0f3db..d184c5cbf 100644 --- a/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php +++ b/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\Reflector; +namespace Roave\BetterReflectionTest\SourceLocator\Ast\Strategy; use PhpParser\Node; use PhpParser\NodeTraverser; diff --git a/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php b/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php index 14cefc59e..b703bca79 100644 --- a/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php +++ b/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\SourceLocator\Type\Composer\Psr\Exception; +namespace Roave\BetterReflectionTest\SourceLocator\Type\Composer\Psr\Excetion; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; From f34a362460ea64c450a1b29aa01208088b617ad2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 10 Sep 2026 10:05:46 +0700 Subject: [PATCH 02/10] final touch: better ruleset name for root entry point --- structarmed.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/structarmed.php b/structarmed.php index 3f5176511..9a0dacdfb 100644 --- a/structarmed.php +++ b/structarmed.php @@ -10,7 +10,7 @@ __DIR__ . '/test/unit/Fixture', ]) ->withPreset(Preset::PSR4()) - ->layerPattern('Facade', '/^Roave\\\\BetterReflection\\\\BetterReflection$/') + ->layerPattern('Root', '/^Roave\\\\BetterReflection\\\\BetterReflection$/') ->layerPattern('Identifier', '/^Roave\\\\BetterReflection\\\\Identifier\\\\.*$/') ->layerPattern('NodeCompiler', '/^Roave\\\\BetterReflection\\\\NodeCompiler\\\\.*$/') ->layerPattern( @@ -38,17 +38,17 @@ ->layerPattern('Composer', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/') ->layerPattern('Util', '/^Roave\\\\BetterReflection\\\\Util\\\\.*$/') ->ruleset([ - 'Facade' => ['+SourceLocatorType'], + 'Root' => ['+SourceLocatorType'], 'Identifier' => ['Reflection'], 'NodeCompiler' => ['Reflection', 'Reflector', 'Util'], - 'Reflection' => ['+NodeCompiler', 'ReflectionAdapter', 'Facade', 'Located', 'SourceLocatorType'], + 'Reflection' => ['+NodeCompiler', 'ReflectionAdapter', 'Root', 'Located', 'SourceLocatorType'], 'ReflectionAdapter' => ['Reflection', 'Reflector', 'Util'], 'Reflector' => ['Identifier', 'Reflection', 'SourceLocatorType'], 'SourceLocator' => [], 'SourceLocatorAst' => ['+Reflector', 'Located', 'Util'], 'Located' => ['SourceLocator', 'Util'], 'SourceStubber' => ['Reflection', 'SourceLocator', 'Util'], - 'SourceLocatorType' => ['+SourceLocatorAst', 'Facade', 'SourceLocator', 'SourceStubber', 'Util'], + 'SourceLocatorType' => ['+SourceLocatorAst', 'Root', 'SourceLocator', 'SourceStubber', 'Util'], 'Composer' => ['+SourceLocatorType'], 'Util' => ['+SourceLocatorAst', 'SourceLocator', 'SourceLocatorType'], ]); From 385685682c8f61911770da4b3c448637bb871f5f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 10 Sep 2026 10:20:38 +0700 Subject: [PATCH 03/10] final touch: clean up rulset definition already covered by +LayerName expansion --- structarmed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/structarmed.php b/structarmed.php index 9a0dacdfb..5913a14b5 100644 --- a/structarmed.php +++ b/structarmed.php @@ -48,7 +48,7 @@ 'SourceLocatorAst' => ['+Reflector', 'Located', 'Util'], 'Located' => ['SourceLocator', 'Util'], 'SourceStubber' => ['Reflection', 'SourceLocator', 'Util'], - 'SourceLocatorType' => ['+SourceLocatorAst', 'Root', 'SourceLocator', 'SourceStubber', 'Util'], + 'SourceLocatorType' => ['+SourceLocatorAst', 'Root', 'SourceLocator', 'SourceStubber'], 'Composer' => ['+SourceLocatorType'], - 'Util' => ['+SourceLocatorAst', 'SourceLocator', 'SourceLocatorType'], + 'Util' => ['+SourceLocatorAst', 'SourceLocator'], ]); From 3643005c28b4c01689fc7928f3d40d7452d1e636 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 12 Sep 2026 17:25:55 +0700 Subject: [PATCH 04/10] simplify config with layer() instead of layerPattern() --- structarmed.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/structarmed.php b/structarmed.php index 5913a14b5..4bef7a937 100644 --- a/structarmed.php +++ b/structarmed.php @@ -10,33 +10,29 @@ __DIR__ . '/test/unit/Fixture', ]) ->withPreset(Preset::PSR4()) - ->layerPattern('Root', '/^Roave\\\\BetterReflection\\\\BetterReflection$/') - ->layerPattern('Identifier', '/^Roave\\\\BetterReflection\\\\Identifier\\\\.*$/') - ->layerPattern('NodeCompiler', '/^Roave\\\\BetterReflection\\\\NodeCompiler\\\\.*$/') - ->layerPattern( - 'Reflection', + ->layer('Root', 'src/BetterReflection.php') + ->layer('Identifier', 'src/Identifier/') + ->layer('NodeCompiler', 'src/NodeCompiler/') + ->layerPattern('Reflection', '/^Roave\\\\BetterReflection\\\\Reflection\\\\.*$/', '/^Roave\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\.*$/' ) - ->layerPattern('ReflectionAdapter', '/^Roave\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\.*$/') - ->layerPattern('Reflector', '/^Roave\\\\BetterReflection\\\\Reflector\\\\.*$/') - ->layerPattern( - 'SourceLocator', - [ - '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\FileChecker$/', - '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Exception\\\\.*$/', - ] - ) - ->layerPattern('SourceLocatorAst', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Ast\\\\.*$/') - ->layerPattern('Located', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Located\\\\.*$/') - ->layerPattern('SourceStubber', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\SourceStubber\\\\.*$/') + ->layer('ReflectionAdapter', 'src/Reflection/Adapter/') + ->layer('Reflector', 'src/Reflector/') + ->layer('SourceLocator', [ + 'src/SourceLocator/FileChecker.php', + 'src/SourceLocator/Exception/', + ]) + ->layer('SourceLocatorAst', 'src/SourceLocator/Ast/') + ->layer('Located', 'src/SourceLocator/Located/') + ->layer('SourceStubber', 'src/SourceLocator/SourceStubber/') ->layerPattern( 'SourceLocatorType', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\.*$/', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/' ) - ->layerPattern('Composer', '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/') - ->layerPattern('Util', '/^Roave\\\\BetterReflection\\\\Util\\\\.*$/') + ->layer('Composer', 'src/SourceLocator/Type/Composer/') + ->layer('Util', 'src/Util/') ->ruleset([ 'Root' => ['+SourceLocatorType'], 'Identifier' => ['Reflection'], From 144d6ec9a179d80eecdd6bb8d960060e1e9f4b11 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 13 Sep 2026 00:25:49 +0700 Subject: [PATCH 05/10] clean up to no more layerPattern() --- structarmed.php | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/structarmed.php b/structarmed.php index 4bef7a937..d16fb7e53 100644 --- a/structarmed.php +++ b/structarmed.php @@ -13,11 +13,7 @@ ->layer('Root', 'src/BetterReflection.php') ->layer('Identifier', 'src/Identifier/') ->layer('NodeCompiler', 'src/NodeCompiler/') - ->layerPattern('Reflection', - '/^Roave\\\\BetterReflection\\\\Reflection\\\\.*$/', - '/^Roave\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\.*$/' - ) - ->layer('ReflectionAdapter', 'src/Reflection/Adapter/') + ->layer('Reflection', 'src/Reflection/') ->layer('Reflector', 'src/Reflector/') ->layer('SourceLocator', [ 'src/SourceLocator/FileChecker.php', @@ -26,25 +22,18 @@ ->layer('SourceLocatorAst', 'src/SourceLocator/Ast/') ->layer('Located', 'src/SourceLocator/Located/') ->layer('SourceStubber', 'src/SourceLocator/SourceStubber/') - ->layerPattern( - 'SourceLocatorType', - '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\.*$/', - '/^Roave\\\\BetterReflection\\\\SourceLocator\\\\Type\\\\Composer\\\\.*$/' - ) - ->layer('Composer', 'src/SourceLocator/Type/Composer/') + ->layer('SourceLocatorType', 'src/SourceLocator/Type/') ->layer('Util', 'src/Util/') ->ruleset([ 'Root' => ['+SourceLocatorType'], 'Identifier' => ['Reflection'], 'NodeCompiler' => ['Reflection', 'Reflector', 'Util'], - 'Reflection' => ['+NodeCompiler', 'ReflectionAdapter', 'Root', 'Located', 'SourceLocatorType'], - 'ReflectionAdapter' => ['Reflection', 'Reflector', 'Util'], - 'Reflector' => ['Identifier', 'Reflection', 'SourceLocatorType'], + 'Reflection' => ['+NodeCompiler', 'Located', 'Root', 'SourceLocatorType'], + 'Reflector' => ['+Identifier', 'SourceLocatorType'], 'SourceLocator' => [], 'SourceLocatorAst' => ['+Reflector', 'Located', 'Util'], 'Located' => ['SourceLocator', 'Util'], 'SourceStubber' => ['Reflection', 'SourceLocator', 'Util'], - 'SourceLocatorType' => ['+SourceLocatorAst', 'Root', 'SourceLocator', 'SourceStubber'], - 'Composer' => ['+SourceLocatorType'], + 'SourceLocatorType' => ['+SourceLocatorAst', '+SourceStubber', 'Root'], 'Util' => ['+SourceLocatorAst', 'SourceLocator'], ]); From 80e3d419320d96ff1319640ab6f2c51de2a10a46 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 13 Sep 2026 01:32:38 +0700 Subject: [PATCH 06/10] rename Excetion to Exception folder in test --- .../Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php b/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php index b703bca79..14cefc59e 100644 --- a/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php +++ b/test/unit/SourceLocator/Type/Composer/Psr/Exception/InvalidPrefixMappingTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Roave\BetterReflectionTest\SourceLocator\Type\Composer\Psr\Excetion; +namespace Roave\BetterReflectionTest\SourceLocator\Type\Composer\Psr\Exception; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; From e0715959cbf5de763e9d50fc70cea62c8f470ed6 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 15 Sep 2026 17:24:00 +0700 Subject: [PATCH 07/10] bump to structarmed ^0.17.7 --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 78428f9f8..afdf2e679 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "phpbench/phpbench": "^1.7.0", "phpunit/phpunit": "^13.4.3", - "boundwize/structarmed": "^0.17.2" + "boundwize/structarmed": "^0.17.7" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 9903bddd5..c9b751264 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": "0c9501bc15028f833c91ae07ac69efe9", + "content-hash": "daa6b6595d0d2af753d1c6ac406535b2", "packages": [ { "name": "jetbrains/phpstorm-stubs", From 8be3270634205958ae94629d0f39b03f20cf4dfc Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 19 Sep 2026 19:12:38 +0700 Subject: [PATCH 08/10] bump structarmed to ^0.17.10 --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index afdf2e679..490a8a35e 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "phpbench/phpbench": "^1.7.0", "phpunit/phpunit": "^13.4.3", - "boundwize/structarmed": "^0.17.7" + "boundwize/structarmed": "^0.17.10" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index c9b751264..e6702dc0a 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": "daa6b6595d0d2af753d1c6ac406535b2", + "content-hash": "57319217c01ec946c3eb842dde88840a", "packages": [ { "name": "jetbrains/phpstorm-stubs", From 3036c34cf3f82bef7d7031277f6e1b36677e3cb4 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 24 Sep 2026 23:34:25 +0700 Subject: [PATCH 09/10] bump to structarmed ^0.18.0 --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 490a8a35e..62e7e391d 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "phpbench/phpbench": "^1.7.0", "phpunit/phpunit": "^13.4.3", - "boundwize/structarmed": "^0.17.10" + "boundwize/structarmed": "^0.18.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index e6702dc0a..135e7b76d 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": "57319217c01ec946c3eb842dde88840a", + "content-hash": "3e46540dc30cd576454feecb161bb1c1", "packages": [ { "name": "jetbrains/phpstorm-stubs", @@ -180,23 +180,23 @@ }, { "name": "boundwize/structarmed", - "version": "0.17.12", + "version": "0.18.11", "source": { "type": "git", "url": "https://github.com/boundwize/structarmed.git", - "reference": "05a625da831db09d581f37357682d6cbce4db603" + "reference": "21d20e29234b4b106718639a12dc3dd343d2e05b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/boundwize/structarmed/zipball/05a625da831db09d581f37357682d6cbce4db603", - "reference": "05a625da831db09d581f37357682d6cbce4db603", + "url": "https://api.github.com/repos/boundwize/structarmed/zipball/21d20e29234b4b106718639a12dc3dd343d2e05b", + "reference": "21d20e29234b4b106718639a12dc3dd343d2e05b", "shasum": "" }, "require": { "boundwize/jsonrecast": "^1.0", "composer-runtime-api": "^2.0", "fidry/cpu-core-counter": "^1.3", - "nikic/php-parser": "^5.8", + "nikic/php-parser": "^5.9", "php": "^8.2" }, "require-dev": { @@ -246,7 +246,7 @@ ], "support": { "issues": "https://github.com/boundwize/structarmed/issues", - "source": "https://github.com/boundwize/structarmed/tree/0.17.12" + "source": "https://github.com/boundwize/structarmed/tree/0.18.11" }, "funding": [ { @@ -254,7 +254,7 @@ "type": "github" } ], - "time": "2026-09-20T13:16:10+00:00" + "time": "2026-10-04T10:04:54+00:00" }, { "name": "doctrine/annotations", From 3e250e13f66ddf2d0888a33c835d74776a946ddc Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 12 Oct 2026 15:52:15 +0700 Subject: [PATCH 10/10] bump to structarmed 0.19.4 --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 62e7e391d..88c4fc931 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "phpbench/phpbench": "^1.7.0", "phpunit/phpunit": "^13.4.3", - "boundwize/structarmed": "^0.18.0" + "boundwize/structarmed": "^0.19.4" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 135e7b76d..7c0a337b3 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": "3e46540dc30cd576454feecb161bb1c1", + "content-hash": "7445da69da60347e07a440ae877c55e2", "packages": [ { "name": "jetbrains/phpstorm-stubs", @@ -180,22 +180,22 @@ }, { "name": "boundwize/structarmed", - "version": "0.18.11", + "version": "0.19.5", "source": { "type": "git", "url": "https://github.com/boundwize/structarmed.git", - "reference": "21d20e29234b4b106718639a12dc3dd343d2e05b" + "reference": "457f6f55649e3dddc9aaaaa00bb29141addc6431" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/boundwize/structarmed/zipball/21d20e29234b4b106718639a12dc3dd343d2e05b", - "reference": "21d20e29234b4b106718639a12dc3dd343d2e05b", + "url": "https://api.github.com/repos/boundwize/structarmed/zipball/457f6f55649e3dddc9aaaaa00bb29141addc6431", + "reference": "457f6f55649e3dddc9aaaaa00bb29141addc6431", "shasum": "" }, "require": { "boundwize/jsonrecast": "^1.0", "composer-runtime-api": "^2.0", - "fidry/cpu-core-counter": "^1.3", + "fidry/cpu-core-counter": "^1.4", "nikic/php-parser": "^5.9", "php": "^8.2" }, @@ -246,7 +246,7 @@ ], "support": { "issues": "https://github.com/boundwize/structarmed/issues", - "source": "https://github.com/boundwize/structarmed/tree/0.18.11" + "source": "https://github.com/boundwize/structarmed/tree/0.19.5" }, "funding": [ { @@ -254,7 +254,7 @@ "type": "github" } ], - "time": "2026-10-04T10:04:54+00:00" + "time": "2026-10-17T08:34:45+00:00" }, { "name": "doctrine/annotations",