From 5980f7263033bec4c65b7dc53ef3363ada023286 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Tue, 7 Apr 2026 23:03:47 +0100 Subject: [PATCH 1/2] tweak: return rather than exit --- composer.json | 4 +- composer.lock | 119 +++++++++++++++++++++-------------------- src/Cli/RunCommand.php | 4 +- 3 files changed, 67 insertions(+), 60 deletions(-) diff --git a/composer.json b/composer.json index 9b401b4..a669019 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,8 @@ "require": { "php": ">=8.2", "ext-json": "*", - "phpgt/cli": "^v1.3.0", - "phpgt/sync": "^1.3.0", + "phpgt/cli": "^1.4", + "phpgt/sync": "^1.3", "webmozart/glob": "v4.4.*", "composer/semver": "v3.*" }, diff --git a/composer.lock b/composer.lock index e4b5c18..6a297ee 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": "27f69e776da2136647b11aa9bb0117e2", + "content-hash": "bbc18ac17beadd109bab0374beb98605", "packages": [ { "name": "composer/semver", @@ -85,27 +85,29 @@ }, { "name": "phpgt/cli", - "version": "v1.3.4", + "version": "v1.4.0", "source": { "type": "git", - "url": "https://github.com/PhpGt/Cli.git", - "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da" + "url": "https://github.com/phpgt/Cli.git", + "reference": "84a1b720efe836624313061ac42e81dd7d9c2948" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Cli/zipball/71deb9cdc5a3ea8bfb665faa29739badbf61e9da", - "reference": "71deb9cdc5a3ea8bfb665faa29739badbf61e9da", + "url": "https://api.github.com/repos/phpgt/Cli/zipball/84a1b720efe836624313061ac42e81dd7d9c2948", + "reference": "84a1b720efe836624313061ac42e81dd7d9c2948", "shasum": "" }, "require": { "ext-json": "*", "ext-readline": "*", - "php": ">=8.0", - "phpgt/daemon": "^v1.1" + "php": ">=8.2", + "phpgt/daemon": "^1.1.3" }, "require-dev": { - "phpstan/phpstan": "^v1.8", - "phpunit/phpunit": "^v9.5" + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -131,8 +133,8 @@ "webengine" ], "support": { - "issues": "https://github.com/PhpGt/Cli/issues", - "source": "https://github.com/PhpGt/Cli/tree/v1.3.4" + "issues": "https://github.com/phpgt/Cli/issues", + "source": "https://github.com/phpgt/Cli/tree/v1.4.0" }, "funding": [ { @@ -140,28 +142,31 @@ "type": "github" } ], - "time": "2023-09-18T10:06:17+00:00" + "time": "2026-03-08T23:28:56+00:00" }, { "name": "phpgt/daemon", - "version": "v1.1.2", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/PhpGt/Daemon.git", - "reference": "6490df99a22818149f30e3af408002ea7f73e035" + "url": "https://github.com/phpgt/Daemon.git", + "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Daemon/zipball/6490df99a22818149f30e3af408002ea7f73e035", - "reference": "6490df99a22818149f30e3af408002ea7f73e035", + "url": "https://api.github.com/repos/phpgt/Daemon/zipball/413e16b54de6e1fd5c2b646b485f88a86dfedd9a", + "reference": "413e16b54de6e1fd5c2b646b485f88a86dfedd9a", "shasum": "" }, "require": { - "php": ">=7.4" + "ext-pcntl": "*", + "php": ">=8.1" }, "require-dev": { - "phpstan/phpstan": ">=0.12.42", - "phpunit/phpunit": "9.*" + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^v1.10", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -172,29 +177,29 @@ "notification-url": "https://packagist.org/downloads/", "description": "Background script execution with cross-platform compatible streaming.", "support": { - "issues": "https://github.com/PhpGt/Daemon/issues", - "source": "https://github.com/PhpGt/Daemon/tree/v1.1.2" + "issues": "https://github.com/phpgt/Daemon/issues", + "source": "https://github.com/phpgt/Daemon/tree/v1.1.5" }, "funding": [ { - "url": "https://github.com/phpgt", + "url": "https://github.com/sponsors/PhpGt", "type": "github" } ], - "time": "2021-02-02T17:33:16+00:00" + "time": "2026-03-11T14:11:10+00:00" }, { "name": "phpgt/sync", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", - "url": "https://github.com/PhpGt/Sync.git", - "reference": "5d1ee6aaa0b97919629c83a90745a1407ddfd66c" + "url": "https://github.com/phpgt/Sync.git", + "reference": "147c2ae1f3670bc606093892a01175584c082e64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Sync/zipball/5d1ee6aaa0b97919629c83a90745a1407ddfd66c", - "reference": "5d1ee6aaa0b97919629c83a90745a1407ddfd66c", + "url": "https://api.github.com/repos/phpgt/Sync/zipball/147c2ae1f3670bc606093892a01175584c082e64", + "reference": "147c2ae1f3670bc606093892a01175584c082e64", "shasum": "" }, "require": { @@ -230,8 +235,8 @@ "synchronize" ], "support": { - "issues": "https://github.com/PhpGt/Sync/issues", - "source": "https://github.com/PhpGt/Sync/tree/v1.3.0" + "issues": "https://github.com/phpgt/Sync/issues", + "source": "https://github.com/phpgt/Sync/tree/v1.3.1" }, "funding": [ { @@ -239,7 +244,7 @@ "type": "github" } ], - "time": "2023-07-07T16:49:08+00:00" + "time": "2026-03-15T17:45:10+00:00" }, { "name": "webmozart/assert", @@ -2549,16 +2554,16 @@ }, { "name": "symfony/config", - "version": "v7.4.6", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9400e2f9226b3b64ebb0a8ae967ae84e54e39640" + "reference": "2d19dde43fa2ff720b9a40763ace7226594f503b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9400e2f9226b3b64ebb0a8ae967ae84e54e39640", - "reference": "9400e2f9226b3b64ebb0a8ae967ae84e54e39640", + "url": "https://api.github.com/repos/symfony/config/zipball/2d19dde43fa2ff720b9a40763ace7226594f503b", + "reference": "2d19dde43fa2ff720b9a40763ace7226594f503b", "shasum": "" }, "require": { @@ -2604,7 +2609,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.4.6" + "source": "https://github.com/symfony/config/tree/v7.4.8" }, "funding": [ { @@ -2624,20 +2629,20 @@ "type": "tidelift" } ], - "time": "2026-02-25T16:50:00+00:00" + "time": "2026-03-24T13:12:05+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.4.6", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "a3f7d594ca53a34a7d39ae683fbca09408b0c598" + "reference": "f7025fd7b687c240426562f86ada06a93b1e771d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a3f7d594ca53a34a7d39ae683fbca09408b0c598", - "reference": "a3f7d594ca53a34a7d39ae683fbca09408b0c598", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f7025fd7b687c240426562f86ada06a93b1e771d", + "reference": "f7025fd7b687c240426562f86ada06a93b1e771d", "shasum": "" }, "require": { @@ -2688,7 +2693,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.4.6" + "source": "https://github.com/symfony/dependency-injection/tree/v7.4.8" }, "funding": [ { @@ -2708,7 +2713,7 @@ "type": "tidelift" } ], - "time": "2026-02-25T16:50:00+00:00" + "time": "2026-03-31T06:50:29+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2779,16 +2784,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.4.6", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "3ebc794fa5315e59fd122561623c2e2e4280538e" + "reference": "58b9790d12f9670b7f53a1c1738febd3108970a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3ebc794fa5315e59fd122561623c2e2e4280538e", - "reference": "3ebc794fa5315e59fd122561623c2e2e4280538e", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/58b9790d12f9670b7f53a1c1738febd3108970a5", + "reference": "58b9790d12f9670b7f53a1c1738febd3108970a5", "shasum": "" }, "require": { @@ -2825,7 +2830,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.6" + "source": "https://github.com/symfony/filesystem/tree/v7.4.8" }, "funding": [ { @@ -2845,7 +2850,7 @@ "type": "tidelift" } ], - "time": "2026-02-25T16:50:00+00:00" + "time": "2026-03-24T13:12:05+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3104,16 +3109,16 @@ }, { "name": "symfony/var-exporter", - "version": "v7.4.0", + "version": "v7.4.8", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "03a60f169c79a28513a78c967316fbc8bf17816f" + "reference": "398907e89a2a56fe426f7955c6fa943ec0c77225" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/03a60f169c79a28513a78c967316fbc8bf17816f", - "reference": "03a60f169c79a28513a78c967316fbc8bf17816f", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/398907e89a2a56fe426f7955c6fa943ec0c77225", + "reference": "398907e89a2a56fe426f7955c6fa943ec0c77225", "shasum": "" }, "require": { @@ -3161,7 +3166,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.4.0" + "source": "https://github.com/symfony/var-exporter/tree/v7.4.8" }, "funding": [ { @@ -3181,7 +3186,7 @@ "type": "tidelift" } ], - "time": "2025-09-11T10:15:23+00:00" + "time": "2026-03-24T13:12:05+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Cli/RunCommand.php b/src/Cli/RunCommand.php index 27d7669..ae876b9 100644 --- a/src/Cli/RunCommand.php +++ b/src/Cli/RunCommand.php @@ -8,7 +8,7 @@ use Gt\Cli\Parameter\Parameter; class RunCommand extends Command { - public function run(?ArgumentValueList $arguments = null):void { + public function run(?ArgumentValueList $arguments = null):int { $buildRunner = new BuildRunner(getcwd(), $this->stream); if($arguments->contains("default")) { $buildRunner->setDefaultPath($arguments->get("default")); @@ -17,6 +17,8 @@ public function run(?ArgumentValueList $arguments = null):void { $arguments->contains("watch"), $arguments->get("mode"), ); + + return 0; } public function getName():string { From 081e4c0c6b38e0a65317116fef00d365c5423c86 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Tue, 7 Apr 2026 23:23:40 +0100 Subject: [PATCH 2/2] test: optional mode argument --- src/Cli/RunCommand.php | 6 +++++- test/phpunit/RunCommandTest.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/phpunit/RunCommandTest.php diff --git a/src/Cli/RunCommand.php b/src/Cli/RunCommand.php index ae876b9..ee1dd21 100644 --- a/src/Cli/RunCommand.php +++ b/src/Cli/RunCommand.php @@ -13,9 +13,13 @@ public function run(?ArgumentValueList $arguments = null):int { if($arguments->contains("default")) { $buildRunner->setDefaultPath($arguments->get("default")); } + $mode = null; + if($arguments->contains("mode")) { + $mode = (string)$arguments->get("mode"); + } $buildRunner->run( $arguments->contains("watch"), - $arguments->get("mode"), + $mode, ); return 0; diff --git a/test/phpunit/RunCommandTest.php b/test/phpunit/RunCommandTest.php new file mode 100644 index 0000000..c2545fc --- /dev/null +++ b/test/phpunit/RunCommandTest.php @@ -0,0 +1,30 @@ +setStream(); + $arguments = new ArgumentValueList(); + $exitCode = $sut->run($arguments); + + self::assertSame(0, $exitCode); + } + finally { + chdir($cwd); + unlink($tempDir . DIRECTORY_SEPARATOR . "build.json"); + rmdir($tempDir); + } + } +}