From f0e7bbac637045c2b81ba97f274414983eab7ae0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Mar 2026 21:32:19 +0000 Subject: [PATCH 1/4] Add php-scoper to phar build to prevent namespace conflicts All vendor dependencies (nikic/php-parser, symfony/*, phpstan/phpdoc-parser, webmozart/assert, ondram/ci-detector) are prefixed with PhpArkitect\ inside the phar, eliminating conflicts when the host project uses the same libraries. The Arkitect\ namespace is excluded from scoping so end-user config files remain unaffected. https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G --- Makefile | 2 +- box.json | 1 + scoper.inc.php | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scoper.inc.php diff --git a/Makefile b/Makefile index 260c3edc..f39b5856 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ test_%: ## it launches a test phar: ## it creates phar rm -rf ${TMP_DIR} && mkdir -p ${TMP_DIR} - cp -R src bin-stub box.json README.md composer.json phparkitect-stub.php bin ${TMP_DIR} + cp -R src bin-stub box.json README.md composer.json phparkitect-stub.php bin scoper.inc.php ${TMP_DIR} cd ${TMP_DIR} && composer install --prefer-source --no-dev -o bin/box.phar compile -c ${TMP_DIR}/box.json cp ${TMP_DIR}/phparkitect.phar . diff --git a/box.json b/box.json index fadcdf0b..12a7a94a 100644 --- a/box.json +++ b/box.json @@ -12,6 +12,7 @@ ], "compression": "GZ", "compactors": [ + "KevinGH\\Box\\Compactor\\PhpScoper", "KevinGH\\Box\\Compactor\\Json" ], "main": "bin-stub/phparkitect", diff --git a/scoper.inc.php b/scoper.inc.php new file mode 100644 index 00000000..448d0857 --- /dev/null +++ b/scoper.inc.php @@ -0,0 +1,15 @@ + 'PhpArkitect', + + 'expose-global-constants' => true, + 'expose-global-classes' => true, + 'expose-global-functions' => true, + + 'exclude-namespaces' => [ + 'Arkitect', + ], +]; From 4e8701ab11922db2665b7e1d78cea6d119df9945 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Mar 2026 21:33:39 +0000 Subject: [PATCH 2/4] Use _PhpArkitect prefix to avoid confusion with project namespace https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G --- scoper.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scoper.inc.php b/scoper.inc.php index 448d0857..37236db4 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -3,7 +3,7 @@ declare(strict_types=1); return [ - 'prefix' => 'PhpArkitect', + 'prefix' => '_PhpArkitect', 'expose-global-constants' => true, 'expose-global-classes' => true, From f7ef08b72523380021606559ec23a9a497f0e337 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Mar 2026 22:04:16 +0000 Subject: [PATCH 3/4] Exclude Composer namespace from scoping Composer\InstalledVersions is a Composer runtime class used by our own (non-scoped) Arkitect code. Prefixing it breaks the reference at runtime. https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G --- scoper.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/scoper.inc.php b/scoper.inc.php index 37236db4..54fcca35 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -11,5 +11,6 @@ 'exclude-namespaces' => [ 'Arkitect', + 'Composer', ], ]; From dd0e1420abb671c6d4f416a441b91b653b72e22b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Mar 2026 22:05:03 +0000 Subject: [PATCH 4/4] Remove box.json settings that match default values https://claude.ai/code/session_01R4VMqad8oVQw3g1HPwPp8G --- box.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/box.json b/box.json index 12a7a94a..8a34bcdf 100644 --- a/box.json +++ b/box.json @@ -15,9 +15,7 @@ "KevinGH\\Box\\Compactor\\PhpScoper", "KevinGH\\Box\\Compactor\\Json" ], - "main": "bin-stub/phparkitect", "output": "phparkitect.phar", "datetime": "release-date", - "dump-autoload": true, "exclude-composer-files": false } \ No newline at end of file