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/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand All @@ -43,6 +46,7 @@ public function selected(): self
);
}

#[\NoDiscard]
public function selectedWhen(bool $selected): self
{
return new self(
Expand Down
1 change: 1 addition & 0 deletions src/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions src/Center.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private function __construct(private View $inner)
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(View $inner): self
{
return new self($inner);
Expand Down
1 change: 1 addition & 0 deletions src/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private function __construct(private Sequence $cards)
*
* @param Sequence<Card> $cards
*/
#[\NoDiscard]
public static function of(Sequence $cards): self
{
return new self($cards);
Expand Down
2 changes: 2 additions & 0 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private function __construct(private Sequence $elements)
*
* @param Sequence<View> $elements
*/
#[\NoDiscard]
public static function of(Sequence $elements): self
{
return new self($elements);
Expand Down
4 changes: 4 additions & 0 deletions src/NavigationLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand All @@ -43,6 +46,7 @@ public function selected(): self
);
}

#[\NoDiscard]
public function selectedWhen(bool $selected): self
{
return new self(
Expand Down
2 changes: 2 additions & 0 deletions src/Picker.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ private function __construct(
* @param A $selected
* @param Picker\Value<A> $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(
Expand Down
3 changes: 3 additions & 0 deletions src/Picker/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ private function __construct(
*
* @return self<A>
*/
#[\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;
Expand Down
1 change: 1 addition & 0 deletions src/Progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private function __construct()
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function new(): self
{
return new self;
Expand Down
1 change: 1 addition & 0 deletions src/ScrollView.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private function __construct(private View $inner)
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(View $inner): self
{
return new self($inner);
Expand Down
1 change: 1 addition & 0 deletions src/Shape.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum Shape
case cornered;
case circle;

#[\NoDiscard]
public function wrap(View $view): View
{
return match ($this) {
Expand Down
2 changes: 2 additions & 0 deletions src/Shape/Kind.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private function __construct(
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function cornered(View $inner): self
{
return new self($inner, 'cornered');
Expand All @@ -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');
Expand Down
2 changes: 2 additions & 0 deletions src/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions src/Svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private function __construct(private Content $data)
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(Content $data): self
{
return new self($data);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private function __construct(private string $text)
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(string $text): self
{
return new self($text);
Expand Down
1 change: 1 addition & 0 deletions src/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum Theme
/**
* @return Maybe<Content>
*/
#[\NoDiscard]
public function load(Filesystem $filesystem): Maybe
{
return $filesystem
Expand Down
3 changes: 3 additions & 0 deletions src/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -34,6 +36,7 @@ public function leading(View $view): self
);
}

#[\NoDiscard]
public function trailing(View $view): self
{
return new self(
Expand Down
1 change: 1 addition & 0 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
*/
interface View
{
#[\NoDiscard]
public function render(): Content;
}
1 change: 1 addition & 0 deletions src/View/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private function __construct(private View $view)
/**
* @psalm-pure
*/
#[\NoDiscard]
public static function of(View $view): self
{
return new self($view);
Expand Down
2 changes: 2 additions & 0 deletions src/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/Zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down