diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 76cc263..b83ed4e 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -2,58 +2,19 @@ name: QA on: push: - branches: - - main + branches: [main] pull_request: +permissions: + contents: read + concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - php-versions: - runs-on: ubuntu-latest - outputs: - versions: ${{ steps.versions.outputs.version }} - steps: - - uses: actions/checkout@v6 - - id: versions - uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 - with: - upcomingReleases: true - - unit-tests: - needs: php-versions - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: ${{ fromJson(needs.php-versions.outputs.versions) }} - steps: - - uses: actions/checkout@v6 - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - uses: ramsey/composer-install@v3 - - run: composer test - - static-analysis: - uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main - - coverage: - needs: php-versions - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ fromJson(needs.php-versions.outputs.versions)[0] }} - coverage: pcov - - uses: ramsey/composer-install@v3 - - run: composer test -- --coverage-clover coverage.xml - - uses: codecov/codecov-action@v5 - with: - files: coverage.xml - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + qa: + uses: nlemoine/.github/.github/workflows/php-qa.yml@5a92d19b83b7b98b52e7a9b3b1ae2402c5635463 + with: + cs-tool: ecs + secrets: inherit diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..4c2737e --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,17 @@ +name: Release Please + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +concurrency: + group: release-please-${{ github.ref }} + cancel-in-progress: false + +jobs: + release-please: + uses: nlemoine/.github/.github/workflows/release-please.yml@f0bc978711a8fd8c7a2ea4ff1eed581b5eb4df8b diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 775c665..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,19 +0,0 @@ -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -name: release - -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: googleapis/release-please-action@v4 - with: - config-file: release-please-config.json - manifest-file: .release-please-manifest.json diff --git a/composer.json b/composer.json index bf1553d..d94fa4f 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ ], "require": { "php": "^8.2", - "symfony/http-foundation": "^7.3 || ^8.0", - "symfony/process": "^7.3 || ^8.0" + "symfony/http-foundation": "^7.4 || ^8.0", + "symfony/process": "^7.4 || ^8.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.48", @@ -31,9 +31,9 @@ "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^11.0 || ^12.0", "rector/rector": "^2.3", - "rmccue/requests": "^2.0", + "rmccue/requests": "^2.0.1", "spatie/temporary-directory": "^2.3", - "symfony/http-client": "^7.3 || ^8.0", + "symfony/http-client": "^7.4 || ^8.0", "symplify/easy-coding-standard": "^13.0" }, "suggest": { diff --git a/ecs.php b/ecs.php index 612e0fa..4742c83 100644 --- a/ecs.php +++ b/ecs.php @@ -14,12 +14,11 @@ ->withPreparedSets( psr12: true, common: true, - strict: true, ) ->withConfiguredRule(FullyQualifiedStrictTypesFixer::class, [ 'import_symbols' => true, ]) ->withSkip([ - // Skip headers.php as it defines global functions intentionally - __DIR__ . '/src/headers.php', + // Skip functions.php as it defines global functions intentionally + __DIR__ . '/src/Runtime/functions.php', ]); diff --git a/src/Client.php b/src/Client.php index 9cd9bdb..2ad1f12 100644 --- a/src/Client.php +++ b/src/Client.php @@ -54,6 +54,10 @@ public function request(string $method, string $url, ?RequestOptions $options = $fileToExecute = $this->file; } + if ($fileToExecute === null) { + throw new RuntimeException('No file to execute: the client was constructed with a null $file and the URL does not point to a .php file.'); + } + $process = new Process( command: [ $this->getPhpExecutable(), diff --git a/src/Symfony/SymfonyToRequestOptionsAdapter.php b/src/Symfony/SymfonyToRequestOptionsAdapter.php index 3a1f3d4..47aee2e 100644 --- a/src/Symfony/SymfonyToRequestOptionsAdapter.php +++ b/src/Symfony/SymfonyToRequestOptionsAdapter.php @@ -55,6 +55,7 @@ final class SymfonyToRequestOptionsAdapter implements OptionsAdapterInterface 'resolve' => false, // Ignored - DNS resolution not controllable 'no_proxy' => false, // Ignored - use proxy option instead 'max_duration' => false, // Ignored - use timeout instead + 'max_connect_duration' => false, // Ignored - no network connection (Symfony 8.1+) 'bindto' => false, // Ignored - not applicable in CLI context 'capath' => false, // Ignored - use cafile instead 'local_cert' => false, // Not implemented yet diff --git a/tests/ClientHelperMethodsTest.php b/tests/ClientHelperMethodsTest.php index 1cb803a..7a862e6 100644 --- a/tests/ClientHelperMethodsTest.php +++ b/tests/ClientHelperMethodsTest.php @@ -408,7 +408,7 @@ public function testParseHeadersFromOutputWithTrailingContent(): void public function testGlobalsHandlerModifiesGlobals(): void { - $handler = new class implements GlobalsHandler { + $handler = new class() implements GlobalsHandler { public function handle(array &$globals): void { $globals['_SERVER']['MY_CUSTOM_VAR'] = 'test_value'; @@ -435,7 +435,7 @@ public function testGlobalsHandlerInChildProcess(): void ]); ?>'); - $handler = new class implements GlobalsHandler { + $handler = new class() implements GlobalsHandler { public function handle(array &$globals): void { $globals['_SERVER']['MY_CUSTOM_VAR'] = 'test_value'; diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 79d9492..05aeeb0 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; use n5s\HttpCli\Client; +use n5s\HttpCli\InheritEnvGlobalsHandler; use n5s\HttpCli\RequestOptions; use n5s\HttpCli\Response; use PHPUnit\Framework\Attributes\DataProvider; @@ -753,7 +754,7 @@ public function testParentEnvVarsInheritedWithHandler(): void $client = new Client( documentRoot: $this->testDocumentRoot, file: $testFile, - globalsHandler: new \n5s\HttpCli\InheritEnvGlobalsHandler(), + globalsHandler: new InheritEnvGlobalsHandler(), ); $previousValue = getenv('HTTP_CLI_TEST_VAR');