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'
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [Unreleased]

### Changed

- Requires PHP `8.4`
- Requires `innmind/filesystem:~9.0`
- Requires `innmind/time:~1.0`

## 8.0.0 - 2025-04-20

### Added
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"issues": "http://github.com/Innmind/Http/issues"
},
"require": {
"php": "~8.2",
"innmind/url": "~4.0",
"innmind/immutable": "~5.11",
"innmind/filesystem": "~8.0",
"innmind/io": "^3.0.1",
"innmind/time-continuum": "~4.1",
"innmind/media-type": "^2.0.1",
"innmind/validation": "~2.0",
"php": "~8.4",
"innmind/url": "~5.0",
"innmind/immutable": "~6.0",
"innmind/filesystem": "~9.0",
"innmind/io": "~4.0",
"innmind/time": "~1.0",
"innmind/media-type": "~3.0",
"innmind/validation": "~3.0",
"ramsey/uuid": "~4.7"
},
"autoload": {
Expand All @@ -36,8 +36,8 @@
}
},
"require-dev": {
"innmind/static-analysis": "^1.2.1",
"innmind/black-box": "~6.1",
"innmind/static-analysis": "~1.3",
"innmind/black-box": "~6.5",
"innmind/coding-standard": "~2.0",
"symfony/process": "^6.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Content/Multipart/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function size(): Maybe
return Maybe::just(
$this
->chunks()
->fold(new Concat)
->fold(Concat::monoid)
->toEncoding(Str\Encoding::ascii)
->length(),
);
Expand Down
2 changes: 1 addition & 1 deletion src/Content/Multipart/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function size(): Maybe
{
$headers = $this
->headers()
->fold(new Concat)
->fold(Concat::monoid)
->toEncoding(Str\Encoding::ascii)
->length();

Expand Down
8 changes: 5 additions & 3 deletions src/Factory/Files/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ private function buildFile(
*/
return Either::right(File::named(
$name,
Content::atPath(
$this->io,
Path::of($path),
Content::io(
$this
->io
->files()
->read(Path::of($path)),
),
MediaType::maybe($media)->match(
static fn($media) => $media,
Expand Down
14 changes: 7 additions & 7 deletions src/Factory/Header/Factories.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
Header\Referrer,
Header\Parameter,
Header\Parameter\Quality,
TimeContinuum\Format\Http,
Time\Format\Http,
Method,
};
use Innmind\TimeContinuum\Clock;
use Innmind\Time\Clock;
use Innmind\Validation\Is;
use Innmind\MediaType\MediaType;
use Innmind\Url\Url;
Expand Down Expand Up @@ -381,12 +381,12 @@ public function try(Clock $clock, Str $value): Maybe

self::date => Is::string()->nonEmpty()($value->toString())
->maybe()
->flatMap(static fn($value) => $clock->at($value, Http::new()))
->flatMap(static fn($value) => $clock->at($value, Http::new())->maybe())
->map(Date::of(...)),

self::expires => Is::string()->nonEmpty()($value->toString())
->maybe()
->flatMap(static fn($value) => $clock->at($value, Http::new()))
->flatMap(static fn($value) => $clock->at($value, Http::new())->maybe())
->map(Expires::of(...)),

self::host => Url::maybe('http://'.$value->toString())->map(static fn($url) => Host::of(
Expand All @@ -396,17 +396,17 @@ public function try(Clock $clock, Str $value): Maybe

self::ifModifiedSince => Is::string()->nonEmpty()($value->toString())
->maybe()
->flatMap(static fn($value) => $clock->at($value, Http::new()))
->flatMap(static fn($value) => $clock->at($value, Http::new())->maybe())
->map(IfModifiedSince::of(...)),

self::ifUnmodifiedSince => Is::string()->nonEmpty()($value->toString())
->maybe()
->flatMap(static fn($value) => $clock->at($value, Http::new()))
->flatMap(static fn($value) => $clock->at($value, Http::new())->maybe())
->map(IfUnmodifiedSince::of(...)),

self::lastModified => Is::string()->nonEmpty()($value->toString())
->maybe()
->flatMap(static fn($value) => $clock->at($value, Http::new()))
->flatMap(static fn($value) => $clock->at($value, Http::new())->maybe())
->map(LastModified::of(...)),

self::link => $value
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/Header/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Header,
Header\Value,
};
use Innmind\TimeContinuum\Clock;
use Innmind\Time\Clock;
use Innmind\Immutable\Str;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/Headers/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Factory\Header\Factory,
Headers,
};
use Innmind\TimeContinuum\Clock;
use Innmind\Time\Clock;
use Innmind\Immutable\Str;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/HeadersFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Headers,
Factory\Headers\Native,
};
use Innmind\TimeContinuum\Clock;
use Innmind\Time\Clock;

/**
* @psalm-immutable
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/ServerRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ProtocolVersion,
Factory,
};
use Innmind\TimeContinuum\Clock;
use Innmind\Time\Clock;
use Innmind\Filesystem\File\Content;
use Innmind\Url\Url;
use Innmind\IO\IO;
Expand Down
4 changes: 1 addition & 3 deletions src/Header/Accept/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

namespace Innmind\Http\Header\Accept;

use Innmind\Http\{
Header\Parameter,
};
use Innmind\Http\Header\Parameter;
use Innmind\Immutable\{
Str,
Map,
Expand Down
2 changes: 1 addition & 1 deletion src/Header/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function content(): MediaType
#[\Override]
public function normalize(): Header
{
$mediaType = new MediaType(
$mediaType = MediaType::from(
$this->content->topLevel(),
$this->content->subType(),
$this->content->suffix(),
Expand Down
6 changes: 3 additions & 3 deletions src/Header/ContentType/Boundary.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public function value(): string

public function toHeader(): ContentType
{
return ContentType::of(new MediaType\MediaType(
'multipart',
return ContentType::of(MediaType\MediaType::from(
MediaType\TopLevel::multipart,
'form-data',
'',
new MediaType\Parameter(
MediaType\Parameter::from(
'boundary',
$this->value,
),
Expand Down
12 changes: 6 additions & 6 deletions src/Header/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

use Innmind\Http\{
Header,
TimeContinuum\Format\Http,
Time\Format\Http,
};
use Innmind\TimeContinuum\{
PointInTime,
use Innmind\Time\{
Point,
Offset,
};

Expand All @@ -18,19 +18,19 @@
final class Date implements Custom
{
private function __construct(
private PointInTime $point,
private Point $point,
) {
}

/**
* @psalm-pure
*/
public static function of(PointInTime $point): self
public static function of(Point $point): self
{
return new self($point);
}

public function date(): PointInTime
public function date(): Point
{
return $this->point;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Header/Expires.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

use Innmind\Http\{
Header,
TimeContinuum\Format\Http,
Time\Format\Http,
};
use Innmind\TimeContinuum\{
PointInTime,
use Innmind\Time\{
Point,
Offset,
};

Expand All @@ -18,19 +18,19 @@
final class Expires implements Custom
{
private function __construct(
private PointInTime $point,
private Point $point,
) {
}

/**
* @psalm-pure
*/
public static function of(PointInTime $point): self
public static function of(Point $point): self
{
return new self($point);
}

public function date(): PointInTime
public function date(): Point
{
return $this->point;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Header/IfModifiedSince.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

use Innmind\Http\{
Header,
TimeContinuum\Format\Http,
Time\Format\Http,
};
use Innmind\TimeContinuum\{
PointInTime,
use Innmind\Time\{
Point,
Offset,
};

Expand All @@ -18,19 +18,19 @@
final class IfModifiedSince implements Custom
{
private function __construct(
private PointInTime $point,
private Point $point,
) {
}

/**
* @psalm-pure
*/
public static function of(PointInTime $point): self
public static function of(Point $point): self
{
return new self($point);
}

public function date(): PointInTime
public function date(): Point
{
return $this->point;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Header/IfUnmodifiedSince.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

use Innmind\Http\{
Header,
TimeContinuum\Format\Http,
Time\Format\Http,
};
use Innmind\TimeContinuum\{
PointInTime,
use Innmind\Time\{
Point,
Offset,
};

Expand All @@ -18,19 +18,19 @@
final class IfUnmodifiedSince implements Custom
{
private function __construct(
private PointInTime $point,
private Point $point,
) {
}

/**
* @psalm-pure
*/
public static function of(PointInTime $point): self
public static function of(Point $point): self
{
return new self($point);
}

public function date(): PointInTime
public function date(): Point
{
return $this->point;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Header/LastModified.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

use Innmind\Http\{
Header,
TimeContinuum\Format\Http,
Time\Format\Http,
};
use Innmind\TimeContinuum\{
PointInTime,
use Innmind\Time\{
Point,
Offset,
};

Expand All @@ -18,19 +18,19 @@
final class LastModified implements Custom
{
private function __construct(
private PointInTime $point,
private Point $point,
) {
}

/**
* @psalm-pure
*/
public static function of(PointInTime $point): self
public static function of(Point $point): self
{
return new self($point);
}

public function date(): PointInTime
public function date(): Point
{
return $this->point;
}
Expand Down
Loading