diff --git a/psalm.xml b/psalm.xml index 78df975..a2dbf3d 100644 --- a/psalm.xml +++ b/psalm.xml @@ -17,4 +17,7 @@ + + + diff --git a/src/MediaType.php b/src/MediaType.php index d2e7f92..2156f89 100644 --- a/src/MediaType.php +++ b/src/MediaType.php @@ -31,6 +31,7 @@ private function __construct( * @psalm-pure * @no-named-arguments */ + #[\NoDiscard] public static function from( TopLevel $topLevel, string $subType, @@ -61,6 +62,7 @@ public static function from( * * @throws \DomainException */ + #[\NoDiscard] public static function of(string $string): self { return self::attempt($string)->unwrap(); @@ -71,6 +73,7 @@ public static function of(string $string): self * * @return Maybe */ + #[\NoDiscard] public static function maybe(string $string): Maybe { return Maybe::just(Str::of($string)) @@ -98,6 +101,7 @@ public static function maybe(string $string): Maybe * * @return Attempt */ + #[\NoDiscard] public static function attempt(string $string): Attempt { return self::maybe($string)->attempt( @@ -108,6 +112,7 @@ public static function attempt(string $string): Attempt /** * @psalm-pure */ + #[\NoDiscard] public static function null(): self { return new self( @@ -118,16 +123,19 @@ public static function null(): self ); } + #[\NoDiscard] public function topLevel(): TopLevel { return $this->topLevel; } + #[\NoDiscard] public function subType(): string { return $this->subType; } + #[\NoDiscard] public function suffix(): string { return $this->suffix; @@ -136,11 +144,13 @@ public function suffix(): string /** * @return Sequence */ + #[\NoDiscard] public function parameters(): Sequence { return $this->parameters; } + #[\NoDiscard] public function toString(): string { $parameters = $this diff --git a/src/Parameter.php b/src/Parameter.php index 6316dc0..43f3e8b 100644 --- a/src/Parameter.php +++ b/src/Parameter.php @@ -36,6 +36,7 @@ private function __construct(string $name, string $value) /** * @psalm-pure */ + #[\NoDiscard] public static function from(string $name, string $value): self { return new self($name, $value); @@ -46,6 +47,7 @@ public static function from(string $name, string $value): self * * @return Maybe */ + #[\NoDiscard] public static function of(string $string): Maybe { $name = self::NAME; @@ -57,16 +59,19 @@ public static function of(string $string): Maybe ); } + #[\NoDiscard] public function name(): string { return $this->name; } + #[\NoDiscard] public function value(): string { return $this->value; } + #[\NoDiscard] public function toString(): string { return \sprintf( diff --git a/src/TopLevel.php b/src/TopLevel.php index ab5abb3..ec3c474 100644 --- a/src/TopLevel.php +++ b/src/TopLevel.php @@ -26,6 +26,7 @@ enum TopLevel * * @return Maybe */ + #[\NoDiscard] public static function maybe(string $value): Maybe { return Maybe::of(match ($value) {