Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 11 additions & 50 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions .github/workflows/release.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
5 changes: 2 additions & 3 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
4 changes: 4 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/SymfonyToRequestOptionsAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/ClientHelperMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down
3 changes: 2 additions & 1 deletion tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down