diff --git a/psalm.xml b/psalm.xml index 5d768ff..a270b9b 100644 --- a/psalm.xml +++ b/psalm.xml @@ -14,4 +14,7 @@ + + + diff --git a/src/Button.php b/src/Button.php index fed7737..62b7c6a 100644 --- a/src/Button.php +++ b/src/Button.php @@ -21,6 +21,7 @@ private function __construct( /** * @psalm-pure */ + #[\NoDiscard] public static function of(Url $url, View $label): self { return new self($url, $label, false); @@ -29,11 +30,13 @@ public static function of(Url $url, View $label): self /** * @psalm-pure */ + #[\NoDiscard] public static function text(Url $url, string $label): self { return new self($url, Text::of($label), false); } + #[\NoDiscard] public function selected(): self { return new self( @@ -43,6 +46,7 @@ public function selected(): self ); } + #[\NoDiscard] public function selectedWhen(bool $selected): self { return new self( diff --git a/src/Card.php b/src/Card.php index c9a3f86..a4b4ff0 100644 --- a/src/Card.php +++ b/src/Card.php @@ -17,6 +17,7 @@ private function __construct(private View $inner) /** * @psalm-pure */ + #[\NoDiscard] public static function of(View $inner): self { return new self(Center::of($inner)); diff --git a/src/Center.php b/src/Center.php index ffc8917..723b3d1 100644 --- a/src/Center.php +++ b/src/Center.php @@ -17,6 +17,7 @@ private function __construct(private View $inner) /** * @psalm-pure */ + #[\NoDiscard] public static function of(View $inner): self { return new self($inner); diff --git a/src/Grid.php b/src/Grid.php index 6621095..53f0df3 100644 --- a/src/Grid.php +++ b/src/Grid.php @@ -23,6 +23,7 @@ private function __construct(private Sequence $cards) * * @param Sequence $cards */ + #[\NoDiscard] public static function of(Sequence $cards): self { return new self($cards); diff --git a/src/Image.php b/src/Image.php index ec18818..e43eef1 100644 --- a/src/Image.php +++ b/src/Image.php @@ -18,11 +18,13 @@ private function __construct(private Url $src) /** * @psalm-pure */ + #[\NoDiscard] public static function of(Url $src): self { return new self($src); } + #[\NoDiscard] public function shape(Shape $shape): View { return $shape->wrap($this); diff --git a/src/Listing.php b/src/Listing.php index 01a2086..b2d655b 100644 --- a/src/Listing.php +++ b/src/Listing.php @@ -23,6 +23,7 @@ private function __construct(private Sequence $elements) * * @param Sequence $elements */ + #[\NoDiscard] public static function of(Sequence $elements): self { return new self($elements); diff --git a/src/NavigationLink.php b/src/NavigationLink.php index 6deb547..da76ce2 100644 --- a/src/NavigationLink.php +++ b/src/NavigationLink.php @@ -21,6 +21,7 @@ private function __construct( /** * @psalm-pure */ + #[\NoDiscard] public static function of(Url $url, View $label): self { return new self($url, $label, false); @@ -29,11 +30,13 @@ public static function of(Url $url, View $label): self /** * @psalm-pure */ + #[\NoDiscard] public static function text(Url $url, string $label): self { return new self($url, Text::of($label), false); } + #[\NoDiscard] public function selected(): self { return new self( @@ -43,6 +46,7 @@ public function selected(): self ); } + #[\NoDiscard] public function selectedWhen(bool $selected): self { return new self( diff --git a/src/Picker.php b/src/Picker.php index 7fcec84..816f811 100644 --- a/src/Picker.php +++ b/src/Picker.php @@ -29,11 +29,13 @@ private function __construct( * @param A $selected * @param Picker\Value $values */ + #[\NoDiscard] public static function of(\UnitEnum $selected, Picker\Value ...$values): self { return new self($selected, Sequence::of(...$values), false); } + #[\NoDiscard] public function disableWhen(bool $disable): self { return new self( diff --git a/src/Picker/Value.php b/src/Picker/Value.php index 30139a7..02e81bb 100644 --- a/src/Picker/Value.php +++ b/src/Picker/Value.php @@ -28,16 +28,19 @@ private function __construct( * * @return self */ + #[\NoDiscard] public static function of(\UnitEnum $tag, View $view): self { return new self($tag, $view); } + #[\NoDiscard] public function tag(): \UnitEnum { return $this->tag; } + #[\NoDiscard] public function view(): View { return $this->view; diff --git a/src/Progress.php b/src/Progress.php index 8436b08..b44604e 100644 --- a/src/Progress.php +++ b/src/Progress.php @@ -21,6 +21,7 @@ private function __construct() /** * @psalm-pure */ + #[\NoDiscard] public static function new(): self { return new self; diff --git a/src/ScrollView.php b/src/ScrollView.php index 7f8f598..59576ff 100644 --- a/src/ScrollView.php +++ b/src/ScrollView.php @@ -17,6 +17,7 @@ private function __construct(private View $inner) /** * @psalm-pure */ + #[\NoDiscard] public static function of(View $inner): self { return new self($inner); diff --git a/src/Shape.php b/src/Shape.php index 44a0149..78207bd 100644 --- a/src/Shape.php +++ b/src/Shape.php @@ -11,6 +11,7 @@ enum Shape case cornered; case circle; + #[\NoDiscard] public function wrap(View $view): View { return match ($this) { diff --git a/src/Shape/Kind.php b/src/Shape/Kind.php index 2a06e6a..7b8a51d 100644 --- a/src/Shape/Kind.php +++ b/src/Shape/Kind.php @@ -24,6 +24,7 @@ private function __construct( /** * @psalm-pure */ + #[\NoDiscard] public static function cornered(View $inner): self { return new self($inner, 'cornered'); @@ -32,6 +33,7 @@ public static function cornered(View $inner): self /** * @psalm-pure */ + #[\NoDiscard] public static function circle(View $inner): self { return new self($inner, 'circle'); diff --git a/src/Stack.php b/src/Stack.php index bd59286..f4f267b 100644 --- a/src/Stack.php +++ b/src/Stack.php @@ -24,6 +24,7 @@ private function __construct( * @psalm-pure * @no-named-arguments */ + #[\NoDiscard] public static function horizontal(View $first, View $second, View ...$rest): self { return new self(true, Sequence::of($first, $second, ...$rest)); @@ -33,6 +34,7 @@ public static function horizontal(View $first, View $second, View ...$rest): sel * @psalm-pure * @no-named-arguments */ + #[\NoDiscard] public static function vertical(View $first, View $second, View ...$rest): self { return new self(false, Sequence::of($first, $second, ...$rest)); diff --git a/src/Svg.php b/src/Svg.php index fd085db..34d2dd3 100644 --- a/src/Svg.php +++ b/src/Svg.php @@ -17,6 +17,7 @@ private function __construct(private Content $data) /** * @psalm-pure */ + #[\NoDiscard] public static function of(Content $data): self { return new self($data); @@ -25,6 +26,7 @@ public static function of(Content $data): self /** * @param int<1, 100> $size */ + #[\NoDiscard] public function zoom(int $size): View { return Zoom::of($this, $size); diff --git a/src/Text.php b/src/Text.php index 9ff887d..f46a01a 100644 --- a/src/Text.php +++ b/src/Text.php @@ -17,6 +17,7 @@ private function __construct(private string $text) /** * @psalm-pure */ + #[\NoDiscard] public static function of(string $text): self { return new self($text); diff --git a/src/Theme.php b/src/Theme.php index 4da70a9..6955006 100644 --- a/src/Theme.php +++ b/src/Theme.php @@ -22,6 +22,7 @@ enum Theme /** * @return Maybe */ + #[\NoDiscard] public function load(Filesystem $filesystem): Maybe { return $filesystem diff --git a/src/Toolbar.php b/src/Toolbar.php index 3943e81..ab6ceb6 100644 --- a/src/Toolbar.php +++ b/src/Toolbar.php @@ -20,11 +20,13 @@ private function __construct( /** * @psalm-pure */ + #[\NoDiscard] public static function of(View $label): self { return new self($label, null, null); } + #[\NoDiscard] public function leading(View $view): self { return new self( @@ -34,6 +36,7 @@ public function leading(View $view): self ); } + #[\NoDiscard] public function trailing(View $view): self { return new self( diff --git a/src/View.php b/src/View.php index 2e01d7c..4f06425 100644 --- a/src/View.php +++ b/src/View.php @@ -10,5 +10,6 @@ */ interface View { + #[\NoDiscard] public function render(): Content; } diff --git a/src/View/Container.php b/src/View/Container.php index 639fb2b..180acbe 100644 --- a/src/View/Container.php +++ b/src/View/Container.php @@ -22,6 +22,7 @@ private function __construct(private View $view) /** * @psalm-pure */ + #[\NoDiscard] public static function of(View $view): self { return new self($view); diff --git a/src/Window.php b/src/Window.php index 65ce9a0..0e13cdc 100644 --- a/src/Window.php +++ b/src/Window.php @@ -21,11 +21,13 @@ private function __construct( /** * @psalm-pure */ + #[\NoDiscard] public static function of(string $title, ?View $body = null): self { return new self($title, $body, null); } + #[\NoDiscard] public function stylesheet(Url $url): self { return new self( diff --git a/src/Zoom.php b/src/Zoom.php index f64afd8..c0eb36c 100644 --- a/src/Zoom.php +++ b/src/Zoom.php @@ -24,6 +24,7 @@ private function __construct( * * @param int<1, 100> $size */ + #[\NoDiscard] public static function of(View $inner, int $size): self { return new self($inner, $size);