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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]

### Changed

- Requires PHP `8.4`
- Requires `innmind/foundation:~2.1`

## 3.0.0 - 2025-08-02

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
Expand Down
6 changes: 3 additions & 3 deletions src/Request/Frame/Body/Unbounded.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\{
Expand Down
1 change: 0 additions & 1 deletion src/ServerRequest/DecodeCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ private function decode(
$request->protocolVersion(),
$request->headers(),
$request->body(),
$request->environment(),
Cookies::of($parameters->map(
static fn($_, $parameter) => $parameter->value(),
)),
Expand Down
8 changes: 5 additions & 3 deletions src/ServerRequest/DecodeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
Header\ContentType,
};
use Innmind\Filesystem\File\Content;
use Innmind\MediaType\MediaType;
use Innmind\MediaType\{
MediaType,
TopLevel,
};

final class DecodeForm
{
Expand Down Expand Up @@ -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;
}

Expand All @@ -50,7 +53,6 @@ private function decode(
$request->protocolVersion(),
$request->headers(),
Content::none(),
$request->environment(),
$request->cookies(),
$request->query(),
Form::of($post),
Expand Down
1 change: 0 additions & 1 deletion src/ServerRequest/DecodeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 6 additions & 6 deletions tests/Request/ParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -96,7 +96,7 @@ public function testParseGetAllAtOnce()
$io = IO::fromAmbientAuthority()
->streams()
->acquire($tmp);
$io
$_ = $io
->write()
->sink(Sequence::of($content))
->unwrap();
Expand Down Expand Up @@ -126,7 +126,7 @@ public function testParsePostWithoutABody()
$io = IO::fromAmbientAuthority()
->streams()
->acquire($tmp);
$io
$_ = $io
->write()
->sink(Sequence::of($content))
->unwrap();
Expand Down Expand Up @@ -298,7 +298,7 @@ public function testParseGetWithBackslashR()
$io = IO::fromAmbientAuthority()
->streams()
->acquire($tmp);
$io
$_ = $io
->write()
->sink(Sequence::of(Str::of($raw)))
->unwrap();
Expand Down Expand Up @@ -337,7 +337,7 @@ public function testParsePostWithBackslashR()
$io = IO::fromAmbientAuthority()
->streams()
->acquire($tmp);
$io
$_ = $io
->write()
->sink(Sequence::of(Str::of($raw)))
->unwrap();
Expand Down Expand Up @@ -382,7 +382,7 @@ public function testParsePostWithBackslashRWithChunkEndingWithBackslashR()
$io = IO::fromAmbientAuthority()
->streams()
->acquire($tmp);
$io
$_ = $io
->write()
->sink(Sequence::of(Str::of($raw)))
->unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/ServerRequest/DecodeCookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/ServerRequest/DecodeFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/ServerRequest/TransformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -160,7 +160,7 @@ public function testDoesntInjectUserInformationInUrlFromHeaderIfAlreadyInUrl():
$serverRequest = Transform::of()($request);

$this->assertSame(
'some:pwd@/foo',
'some:pwd@host/foo',
$serverRequest->url()->toString(),
);
});
Expand Down