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 @@ -17,4 +17,7 @@
<disableExtensions>
<extension name="random" />
</disableExtensions>
<issueHandlers>
<UndefinedAttributeClass errorLevel="suppress" />
</issueHandlers>
</psalm>
10 changes: 10 additions & 0 deletions src/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ private function __construct(
* @psalm-pure
* @no-named-arguments
*/
#[\NoDiscard]
public static function from(
TopLevel $topLevel,
string $subType,
Expand Down Expand Up @@ -61,6 +62,7 @@ public static function from(
*
* @throws \DomainException
*/
#[\NoDiscard]
public static function of(string $string): self
{
return self::attempt($string)->unwrap();
Expand All @@ -71,6 +73,7 @@ public static function of(string $string): self
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(string $string): Maybe
{
return Maybe::just(Str::of($string))
Expand Down Expand Up @@ -98,6 +101,7 @@ public static function maybe(string $string): Maybe
*
* @return Attempt<self>
*/
#[\NoDiscard]
public static function attempt(string $string): Attempt
{
return self::maybe($string)->attempt(
Expand All @@ -108,6 +112,7 @@ public static function attempt(string $string): Attempt
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function null(): self
{
return new self(
Expand All @@ -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;
Expand All @@ -136,11 +144,13 @@ public function suffix(): string
/**
* @return Sequence<Parameter>
*/
#[\NoDiscard]
public function parameters(): Sequence
{
return $this->parameters;
}

#[\NoDiscard]
public function toString(): string
{
$parameters = $this
Expand Down
5 changes: 5 additions & 0 deletions src/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -46,6 +47,7 @@ public static function from(string $name, string $value): self
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function of(string $string): Maybe
{
$name = self::NAME;
Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/TopLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum TopLevel
*
* @return Maybe<self>
*/
#[\NoDiscard]
public static function maybe(string $value): Maybe
{
return Maybe::of(match ($value) {
Expand Down