diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 189105d..2f3eecb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,5 +12,3 @@ jobs: uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main cs: uses: innmind/github-workflows/.github/workflows/cs.yml@main - with: - php-version: '8.2' diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ac304..75d03a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [Unreleased] + +### Changed + +- Requires PHP `8.4` +- Requires `innmind/foundation:~2.1` + ## 3.0.0 - 2025-08-02 ### Changed diff --git a/README.md b/README.md index 96353fa..599d293 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ use Innmind\HttpParser\{ ServerRequest\DecodeQuery, ServerRequest\DecodeForm, }; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\IO\IO; use Innmind\Http\ServerRequest; use Innmind\Immutable\Str; diff --git a/composer.json b/composer.json index 22fc604..6d9ca9c 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "issues": "http://github.com/innmind/http-parser/issues" }, "require": { - "php": "~8.2", - "innmind/foundation": "~1.4" + "php": "~8.4", + "innmind/foundation": "~2.1" }, "autoload": { "psr-4": { @@ -29,7 +29,7 @@ } }, "require-dev": { - "innmind/static-analysis": "^1.2.1", + "innmind/static-analysis": "~1.3", "innmind/black-box": "^6.4.1", "innmind/coding-standard": "~2.0" } diff --git a/src/Request/Frame/Body/Unbounded.php b/src/Request/Frame/Body/Unbounded.php index 0459f52..2ed0708 100644 --- a/src/Request/Frame/Body/Unbounded.php +++ b/src/Request/Frame/Body/Unbounded.php @@ -51,14 +51,14 @@ private static function bound(Sequence $chunks): Sequence return $chunks ->flatMap(static fn($chunk) => match (true) { $chunk - ->fold(new Concat) + ->fold(Concat::monoid) ->empty() => Sequence::of($end), $chunk - ->fold(new Concat) + ->fold(Concat::monoid) ->equals(Str::of("\r\n\r\n")) => Sequence::of($end), $chunk ->drop(2) - ->fold(new Concat) + ->fold(Concat::monoid) ->equals(Str::of("\n\n")) => $chunk->take(2)->add($end), default => $chunk->take(1), }) diff --git a/src/Request/Parse.php b/src/Request/Parse.php index 143ff8d..9115070 100644 --- a/src/Request/Parse.php +++ b/src/Request/Parse.php @@ -15,7 +15,7 @@ Headers as HttpHeaders, Factory\Header\Factory, }; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\Filesystem\File\Content; use Innmind\Url\Url; use Innmind\IO\{ diff --git a/src/ServerRequest/DecodeCookie.php b/src/ServerRequest/DecodeCookie.php index 09dda63..447adef 100644 --- a/src/ServerRequest/DecodeCookie.php +++ b/src/ServerRequest/DecodeCookie.php @@ -47,7 +47,6 @@ private function decode( $request->protocolVersion(), $request->headers(), $request->body(), - $request->environment(), Cookies::of($parameters->map( static fn($_, $parameter) => $parameter->value(), )), diff --git a/src/ServerRequest/DecodeForm.php b/src/ServerRequest/DecodeForm.php index fb4a1f3..321ea4d 100644 --- a/src/ServerRequest/DecodeForm.php +++ b/src/ServerRequest/DecodeForm.php @@ -9,7 +9,10 @@ Header\ContentType, }; use Innmind\Filesystem\File\Content; -use Innmind\MediaType\MediaType; +use Innmind\MediaType\{ + MediaType, + TopLevel, +}; final class DecodeForm { @@ -38,7 +41,7 @@ private function decode( MediaType $header, ServerRequest $request, ): ServerRequest { - if ($header->topLevel() !== 'application' || $header->subType() !== 'x-www-form-urlencoded') { + if ($header->topLevel() !== TopLevel::application || $header->subType() !== 'x-www-form-urlencoded') { return $request; } @@ -50,7 +53,6 @@ private function decode( $request->protocolVersion(), $request->headers(), Content::none(), - $request->environment(), $request->cookies(), $request->query(), Form::of($post), diff --git a/src/ServerRequest/DecodeQuery.php b/src/ServerRequest/DecodeQuery.php index f416a13..f56eee6 100644 --- a/src/ServerRequest/DecodeQuery.php +++ b/src/ServerRequest/DecodeQuery.php @@ -26,7 +26,6 @@ public function __invoke(ServerRequest $request): ServerRequest $request->protocolVersion(), $request->headers(), $request->body(), - $request->environment(), $request->cookies(), ServerRequest\Query::of($query), $request->form(), diff --git a/tests/Request/ParseTest.php b/tests/Request/ParseTest.php index 9776d3c..41b55d3 100644 --- a/tests/Request/ParseTest.php +++ b/tests/Request/ParseTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\HttpParser\Request; use Innmind\HttpParser\Request\Parse; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\Http\{ Request, Method, @@ -96,7 +96,7 @@ public function testParseGetAllAtOnce() $io = IO::fromAmbientAuthority() ->streams() ->acquire($tmp); - $io + $_ = $io ->write() ->sink(Sequence::of($content)) ->unwrap(); @@ -126,7 +126,7 @@ public function testParsePostWithoutABody() $io = IO::fromAmbientAuthority() ->streams() ->acquire($tmp); - $io + $_ = $io ->write() ->sink(Sequence::of($content)) ->unwrap(); @@ -298,7 +298,7 @@ public function testParseGetWithBackslashR() $io = IO::fromAmbientAuthority() ->streams() ->acquire($tmp); - $io + $_ = $io ->write() ->sink(Sequence::of(Str::of($raw))) ->unwrap(); @@ -337,7 +337,7 @@ public function testParsePostWithBackslashR() $io = IO::fromAmbientAuthority() ->streams() ->acquire($tmp); - $io + $_ = $io ->write() ->sink(Sequence::of(Str::of($raw))) ->unwrap(); @@ -382,7 +382,7 @@ public function testParsePostWithBackslashRWithChunkEndingWithBackslashR() $io = IO::fromAmbientAuthority() ->streams() ->acquire($tmp); - $io + $_ = $io ->write() ->sink(Sequence::of(Str::of($raw))) ->unwrap(); diff --git a/tests/ServerRequest/DecodeCookieTest.php b/tests/ServerRequest/DecodeCookieTest.php index aa208c7..49575a2 100644 --- a/tests/ServerRequest/DecodeCookieTest.php +++ b/tests/ServerRequest/DecodeCookieTest.php @@ -8,7 +8,7 @@ ServerRequest\Transform, Request\Parse, }; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\IO\IO; use Innmind\Http\ServerRequest; use Innmind\BlackBox\PHPUnit\Framework\TestCase; diff --git a/tests/ServerRequest/DecodeFormTest.php b/tests/ServerRequest/DecodeFormTest.php index 7d03e3c..5e337b4 100644 --- a/tests/ServerRequest/DecodeFormTest.php +++ b/tests/ServerRequest/DecodeFormTest.php @@ -8,7 +8,7 @@ ServerRequest\Transform, Request\Parse, }; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\Http\ServerRequest; use Innmind\IO\IO; use Innmind\BlackBox\PHPUnit\Framework\TestCase; diff --git a/tests/ServerRequest/TransformTest.php b/tests/ServerRequest/TransformTest.php index ac77aa0..488f990 100644 --- a/tests/ServerRequest/TransformTest.php +++ b/tests/ServerRequest/TransformTest.php @@ -146,7 +146,7 @@ public function testDoesntInjectUserInformationInUrlFromHeaderIfAlreadyInUrl(): ) ->prove(function($method, $protocol) { $request = Request::of( - Url::of('//some:pwd@/foo'), // without the first // it interprets the host as the scheme + Url::of('//some:pwd@host/foo'), // without the first // it interprets the host as the scheme $method, $protocol, Headers::of( @@ -160,7 +160,7 @@ public function testDoesntInjectUserInformationInUrlFromHeaderIfAlreadyInUrl(): $serverRequest = Transform::of()($request); $this->assertSame( - 'some:pwd@/foo', + 'some:pwd@host/foo', $serverRequest->url()->toString(), ); });