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
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<UndefinedAttributeClass errorLevel="suppress" />
</issueHandlers>
</psalm>
4 changes: 4 additions & 0 deletions src/Content/Multipart.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private function __construct(
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function boundary(Boundary $boundary): self
{
/** @var Sequence<Data|File> */
Expand All @@ -42,6 +43,7 @@ public static function boundary(Boundary $boundary): self
return new self($boundary, $parts);
}

#[\NoDiscard]
public function with(string $name, string $data): self
{
return new self(
Expand All @@ -50,6 +52,7 @@ public function with(string $name, string $data): self
);
}

#[\NoDiscard]
public function withFile(string $name, Binary $file): self
{
return new self(
Expand All @@ -58,6 +61,7 @@ public function withFile(string $name, Binary $file): self
);
}

#[\NoDiscard]
public function asContent(): Content
{
return Content::ofChunks($this->chunks());
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/CookiesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Cookies
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(): self
{
return new self(Native::new());
Expand All @@ -36,6 +38,7 @@ public static function native(): self
*
* @param pure-Closure(): Cookies $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/EnvironmentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Environment
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(): self
{
return new self(Native::new());
Expand All @@ -36,6 +38,7 @@ public static function native(): self
*
* @param pure-Closure(): Environment $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/FilesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Files
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(IO $io): self
{
return new self(Native::new($io));
Expand All @@ -37,6 +39,7 @@ public static function native(IO $io): self
*
* @param pure-Closure(): Files $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/FormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Form
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(): self
{
return new self(Native::new());
Expand All @@ -36,6 +38,7 @@ public static function native(): self
*
* @param pure-Closure(): Form $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/HeadersFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Headers
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(Clock $clock): self
{
return new self(Native::new($clock));
Expand All @@ -37,6 +39,7 @@ public static function native(Clock $clock): self
*
* @param pure-Closure(): Headers $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/QueryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): Query
{
return ($this->implementation)();
}

#[\NoDiscard]
public static function native(): self
{
return new self(Native::new());
Expand All @@ -36,6 +38,7 @@ public static function native(): self
*
* @param pure-Closure(): Query $factory
*/
#[\NoDiscard]
public static function of(\Closure $factory): self
{
return new self($factory);
Expand Down
3 changes: 3 additions & 0 deletions src/Factory/ServerRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private function __construct(
) {
}

#[\NoDiscard]
public function __invoke(): ServerRequest
{
/** @psalm-suppress MixedArgument */
Expand Down Expand Up @@ -94,6 +95,7 @@ public function __invoke(): ServerRequest
/**
* Return a fully configured factory
*/
#[\NoDiscard]
public static function native(
Clock $clock,
?IO $io = null,
Expand Down Expand Up @@ -125,6 +127,7 @@ public static function native(
* @param \Closure(): Content $bodyFactory
* @param array<string, string> $server
*/
#[\NoDiscard]
public static function of(
HeadersFactory $headersFactory,
\Closure $bodyFactory,
Expand Down
4 changes: 4 additions & 0 deletions src/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ private function __construct(
* @psalm-pure
* @no-named-arguments
*/
#[\NoDiscard]
public static function of(string $name, Value ...$values): self
{
return new self($name, Sequence::of(...$values));
}

#[\NoDiscard]
public function name(): string
{
return $this->name;
Expand All @@ -40,11 +42,13 @@ public function name(): string
/**
* @return Sequence<Value>
*/
#[\NoDiscard]
public function values(): Sequence
{
return $this->values;
}

#[\NoDiscard]
public function toString(): string
{
$values = $this->values->map(static fn($value) => $value->toString());
Expand Down
2 changes: 2 additions & 0 deletions src/Header/Accept.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ private function __construct(
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(MediaType $first, MediaType ...$values): self
{
return new self(Sequence::of($first, ...$values));
}

#[\Override]
#[\NoDiscard]
public function normalize(): Header
{
return Header::of(
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Accept/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private function __construct(
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(string $charset, ?Quality $quality = null): Maybe
{
$charset = Str::of($charset);
Expand All @@ -40,11 +41,13 @@ public static function maybe(string $charset, ?Quality $quality = null): Maybe
return Maybe::just(new self($charset, $quality ?? Quality::max()));
}

#[\NoDiscard]
public function quality(): Quality
{
return $this->quality;
}

#[\NoDiscard]
public function toString(): string
{
return $this
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Accept/Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private function __construct(
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(string $coding, ?Quality $quality = null): Maybe
{
$coding = Str::of($coding);
Expand All @@ -40,11 +41,13 @@ public static function maybe(string $coding, ?Quality $quality = null): Maybe
return Maybe::just(new self($coding, $quality ?? Quality::max()));
}

#[\NoDiscard]
public function quality(): Quality
{
return $this->quality;
}

#[\NoDiscard]
public function toString(): string
{
return $this
Expand Down
3 changes: 3 additions & 0 deletions src/Header/Accept/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private function __construct(
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(string $language, ?Quality $quality = null): Maybe
{
$language = Str::of($language);
Expand All @@ -40,11 +41,13 @@ public static function maybe(string $language, ?Quality $quality = null): Maybe
return Maybe::just(new self($language, $quality ?? Quality::max()));
}

#[\NoDiscard]
public function quality(): Quality
{
return $this->quality;
}

#[\NoDiscard]
public function toString(): string
{
return $this
Expand Down
5 changes: 5 additions & 0 deletions src/Header/Accept/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private function __construct(
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(
string $type,
string $subType,
Expand Down Expand Up @@ -57,11 +58,13 @@ public static function maybe(
return Maybe::just(new self($type, $subType, $map));
}

#[\NoDiscard]
public function type(): string
{
return $this->type;
}

#[\NoDiscard]
public function subType(): string
{
return $this->subType;
Expand All @@ -70,11 +73,13 @@ public function subType(): string
/**
* @return Map<string, Parameter>
*/
#[\NoDiscard]
public function parameters(): Map
{
return $this->parameters;
}

#[\NoDiscard]
public function toString(): string
{
$parameters = $this->parameters->values()->map(
Expand Down
2 changes: 2 additions & 0 deletions src/Header/AcceptCharset.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ private function __construct(
* @psalm-pure
* @no-named-arguments
*/
#[\NoDiscard]
public static function of(Charset ...$charsets): self
{
return new self(Sequence::of(...$charsets));
}

#[\Override]
#[\NoDiscard]
public function normalize(): Header
{
return Header::of(
Expand Down
2 changes: 2 additions & 0 deletions src/Header/AcceptEncoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ private function __construct(
* @psalm-pure
* @no-named-arguments
*/
#[\NoDiscard]
public static function of(Encoding ...$encodings): self
{
return new self(Sequence::of(...$encodings));
}

#[\Override]
#[\NoDiscard]
public function normalize(): Header
{
return Header::of(
Expand Down
2 changes: 2 additions & 0 deletions src/Header/AcceptLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ private function __construct(
* @psalm-pure
* @no-named-arguments
*/
#[\NoDiscard]
public static function of(Language ...$languages): self
{
return new self(Sequence::of(...$languages));
}

#[\Override]
#[\NoDiscard]
public function normalize(): Header
{
return Header::of(
Expand Down
Loading