From 0d5f81acd248a1dcec8b09f0124bb393f7fb975d Mon Sep 17 00:00:00 2001 From: aegypius Date: Fri, 14 Nov 2025 11:30:33 +0100 Subject: [PATCH 01/10] chore(deps): bump php requirements to 8.4 --- composer.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 9ebb7e6..2cc7882 100644 --- a/composer.json +++ b/composer.json @@ -14,19 +14,20 @@ } }, "require": { - "php": "^8.3" + "php": "^8.4" }, "require-dev": { "ext-dom": "*", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.1", - "symplify/easy-coding-standard": "^12" + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^2.1.32", + "phpunit/phpunit": "^12.4.3", + "symplify/easy-coding-standard": "^12.6.2" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, + "bump-after-update": true, "allow-plugins": { "phpstan/extension-installer": true } From 5b2a7941e94451971d263227a21520bc4076580c Mon Sep 17 00:00:00 2001 From: aegypius Date: Fri, 14 Nov 2025 11:31:36 +0100 Subject: [PATCH 02/10] feat(dagger): use an image matching platform requirements --- .dagger/src/PhpProject.php | 48 +++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index 17f8744..2884fa5 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -20,6 +20,46 @@ #[Doc("PHP Code Quality functions")] class PhpProject { + private function php( + Directory $source, + string $image = "php", + string $variant = "cli", + ): Container { + global $version; + + if (!isset($version)) { + $output = dag() + ->container() + ->from("composer:2") + ->withMountedDirectory("/app", $source) + ->withWorkdir("/app") + ->withExec([ + "composer", + "show", + "--platform", + "php", + ]) + ->stdout(); + + foreach (explode(PHP_EOL, $output) as $line) { + if (preg_match('/^versions\D+(?(?\d+)\.(?\d+)\.(?\d+)).*/xms', $line, $matches)) { + $version = implode('.', [ + $matches['major'], + $matches['minor'], + ]); + } + } + } + + return dag() + ->container() + ->from(match ($version ?? false) { + false => "{$image}:latest", + default => "{$image}:{$version}-{$variant}" + }) + ; + } + /** * Allows to install vendors with * @@ -48,9 +88,7 @@ public function checkCodingStandards( #[DefaultPath("."), Ignore("**/vendor", "docs")] Directory $source ): Container { - return dag() - ->container() - ->from("php:8.3-cli") + return $this->php(source: $source) ->withMountedDirectory("/app", $source) ->withDirectory("/app/vendor", $this->vendors($source)) ->withWorkdir("/app") @@ -74,9 +112,7 @@ public function test( $phpunit[] = "--testsuite={$testSuite}"; } - return dag() - ->container() - ->from("php:8.3-cli") + return $this->php(source: $source) ->withMountedDirectory("/app", $source) ->withDirectory("/app/vendor", $this->vendors($source)) ->withWorkdir("/app") From 97d72006ab8d4c35c4a0e4caacf06a7b19e1620f Mon Sep 17 00:00:00 2001 From: aegypius Date: Fri, 14 Nov 2025 11:36:02 +0100 Subject: [PATCH 03/10] ci: run workflow on pull-requests --- .dagger/src/PhpProject.php | 3 ++- .github/workflows/continuous-integration.yaml | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index 2884fa5..b83e274 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -47,6 +47,7 @@ private function php( $matches['major'], $matches['minor'], ]); + break; } } } @@ -54,7 +55,7 @@ private function php( return dag() ->container() ->from(match ($version ?? false) { - false => "{$image}:latest", + false => "{$image}:{$variant}", default => "{$image}:{$version}-{$variant}" }) ; diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 45ea442..7dc9ece 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -3,6 +3,8 @@ on: push: branches: - main + pull_request: + branches: [ "main" ] jobs: coding-standards: @@ -34,7 +36,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Check for coding-standards + - name: Run tests uses: dagger/dagger-for-github@8.0.0 with: version: "latest" From 926186a04095bb5f076ab548a24cf7207bc2a53a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:01:44 +0100 Subject: [PATCH 04/10] fix: replace global variable with static class property for PHP version cache (#2) Co-authored-by: aegypius <25710+aegypius@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .dagger/src/PhpProject.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index b83e274..fee989f 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -20,14 +20,14 @@ #[Doc("PHP Code Quality functions")] class PhpProject { + private static string|null $version = null; + private function php( Directory $source, string $image = "php", string $variant = "cli", ): Container { - global $version; - - if (!isset($version)) { + if (self::$version === null) { $output = dag() ->container() ->from("composer:2") @@ -43,7 +43,7 @@ private function php( foreach (explode(PHP_EOL, $output) as $line) { if (preg_match('/^versions\D+(?(?\d+)\.(?\d+)\.(?\d+)).*/xms', $line, $matches)) { - $version = implode('.', [ + self::$version = implode('.', [ $matches['major'], $matches['minor'], ]); @@ -54,9 +54,9 @@ private function php( return dag() ->container() - ->from(match ($version ?? false) { - false => "{$image}:{$variant}", - default => "{$image}:{$version}-{$variant}" + ->from(match (self::$version) { + null => "{$image}:{$variant}", + default => "{$image}:{self::$version}-{$variant}" }) ; } From fe6f891aae7db78bef9f0cb835f1348b58345013 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 21 Jan 2026 18:24:46 +0100 Subject: [PATCH 05/10] docs: add docblock to php() method in PhpProject (#3) Co-authored-by: aegypius <25710+aegypius@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .dagger/src/PhpProject.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index fee989f..c772bbb 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -22,6 +22,18 @@ class PhpProject { private static string|null $version = null; + /** + * Create a PHP container with the appropriate PHP version. + * + * This method detects the platform PHP version using Composer and creates a + * container using the appropriate PHP image. The version is cached in a static + * property to avoid repeated lookups. + * + * @param Directory $source The source directory containing composer.json + * @param string $image The base PHP image name (default: "php") + * @param string $variant The PHP image variant (default: "cli") + * @return Container A container with the appropriate PHP version installed + */ private function php( Directory $source, string $image = "php", From aa501511ebc713e1be1f65ac97a2da702bc1610a Mon Sep 17 00:00:00 2001 From: aegypius Date: Sat, 31 Jan 2026 09:25:45 +0100 Subject: [PATCH 06/10] fix(dagger): drop version guessing --- .dagger/src/PhpProject.php | 34 ++-------------------------------- composer.json | 6 +++--- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index c772bbb..160ecf7 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -20,8 +20,6 @@ #[Doc("PHP Code Quality functions")] class PhpProject { - private static string|null $version = null; - /** * Create a PHP container with the appropriate PHP version. * @@ -37,39 +35,11 @@ class PhpProject private function php( Directory $source, string $image = "php", - string $variant = "cli", + string $variant = "8.5-cli", ): Container { - if (self::$version === null) { - $output = dag() - ->container() - ->from("composer:2") - ->withMountedDirectory("/app", $source) - ->withWorkdir("/app") - ->withExec([ - "composer", - "show", - "--platform", - "php", - ]) - ->stdout(); - - foreach (explode(PHP_EOL, $output) as $line) { - if (preg_match('/^versions\D+(?(?\d+)\.(?\d+)\.(?\d+)).*/xms', $line, $matches)) { - self::$version = implode('.', [ - $matches['major'], - $matches['minor'], - ]); - break; - } - } - } - return dag() ->container() - ->from(match (self::$version) { - null => "{$image}:{$variant}", - default => "{$image}:{self::$version}-{$variant}" - }) + ->from("{$image}:{$variant}") ; } diff --git a/composer.json b/composer.json index 2cc7882..a94c2c9 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ } }, "require": { - "php": "^8.4" + "php": ">8.4" }, "require-dev": { "ext-dom": "*", "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan": "^2.1.32", - "phpunit/phpunit": "^12.4.3", + "phpstan/phpstan": "^2.1.38", + "phpunit/phpunit": "^12.5.8", "symplify/easy-coding-standard": "^12.6.2" }, "config": { From 35b7cdb78d0d7e43cbe5f909a96f81fe41d0e00b Mon Sep 17 00:00:00 2001 From: Nicolas LAURENT Date: Sat, 31 Jan 2026 09:32:32 +0100 Subject: [PATCH 07/10] docs: update method comment to match Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .dagger/src/PhpProject.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index 160ecf7..37178a3 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -21,16 +21,16 @@ class PhpProject { /** - * Create a PHP container with the appropriate PHP version. + * Create a PHP container using the specified image and variant. * - * This method detects the platform PHP version using Composer and creates a - * container using the appropriate PHP image. The version is cached in a static - * property to avoid repeated lookups. + * This method constructs a container from the given PHP image name and + * variant. By default, it uses the "php:8.5-cli" image. It does not perform + * any automatic PHP version detection or caching. * - * @param Directory $source The source directory containing composer.json + * @param Directory $source The source directory (mounted into the container by callers) * @param string $image The base PHP image name (default: "php") - * @param string $variant The PHP image variant (default: "cli") - * @return Container A container with the appropriate PHP version installed + * @param string $variant The PHP image variant tag (default: "8.5-cli") + * @return Container A container based on the specified PHP image */ private function php( Directory $source, From 0f1a6f5bc1e339f8afd94bc9e8dc17215fa73178 Mon Sep 17 00:00:00 2001 From: aegypius Date: Sat, 31 Jan 2026 09:34:53 +0100 Subject: [PATCH 08/10] fix(dagger): remove unused variable --- .dagger/src/PhpProject.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.dagger/src/PhpProject.php b/.dagger/src/PhpProject.php index 37178a3..7795c82 100644 --- a/.dagger/src/PhpProject.php +++ b/.dagger/src/PhpProject.php @@ -27,13 +27,11 @@ class PhpProject * variant. By default, it uses the "php:8.5-cli" image. It does not perform * any automatic PHP version detection or caching. * - * @param Directory $source The source directory (mounted into the container by callers) * @param string $image The base PHP image name (default: "php") * @param string $variant The PHP image variant tag (default: "8.5-cli") * @return Container A container based on the specified PHP image */ private function php( - Directory $source, string $image = "php", string $variant = "8.5-cli", ): Container { @@ -71,7 +69,7 @@ public function checkCodingStandards( #[DefaultPath("."), Ignore("**/vendor", "docs")] Directory $source ): Container { - return $this->php(source: $source) + return $this->php() ->withMountedDirectory("/app", $source) ->withDirectory("/app/vendor", $this->vendors($source)) ->withWorkdir("/app") @@ -95,7 +93,7 @@ public function test( $phpunit[] = "--testsuite={$testSuite}"; } - return $this->php(source: $source) + return $this->php() ->withMountedDirectory("/app", $source) ->withDirectory("/app/vendor", $this->vendors($source)) ->withWorkdir("/app") From bc58448ae4c5162dfd4c2b1af05e2f2153e6dbb1 Mon Sep 17 00:00:00 2001 From: aegypius Date: Sat, 31 Jan 2026 09:36:34 +0100 Subject: [PATCH 09/10] fix: update version constraint --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a94c2c9..aea9a3b 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } }, "require": { - "php": ">8.4" + "php": "^8.5" }, "require-dev": { "ext-dom": "*", From 6bee575ba7e695b07a8ca3a8c3b107a64c100f4e Mon Sep 17 00:00:00 2001 From: aegypius Date: Sat, 31 Jan 2026 09:45:37 +0100 Subject: [PATCH 10/10] fix: update version constraint for dagger module --- .dagger/composer.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.dagger/composer.json b/.dagger/composer.json index d29f850..9bb9e1b 100644 --- a/.dagger/composer.json +++ b/.dagger/composer.json @@ -13,17 +13,12 @@ } ], "require": { - "php": "^8.1", + "php": "^8.4", "dagger/dagger": "*@dev" }, "autoload": { "psr-4": { "DaggerModule\\": "src/" } - }, - "config": { - "platform": { - "php": "8.3.7" - } } }