From 5d3f8e7256d345102c3c3b0e8fed9574e29fcefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mi=C5=A1o=20=C4=8Cerve=C5=88=C3=A1k?= Date: Tue, 15 Aug 2023 20:55:05 +0200 Subject: [PATCH] PHPDoc --- src/Logging/FlashMessageDump.php | 14 ++++++-------- src/Logging/Message.php | 2 +- src/Price/Price.php | 6 ++++++ src/UI/Navigation/NavItem.php | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Logging/FlashMessageDump.php b/src/Logging/FlashMessageDump.php index 5da3c26..7111e91 100644 --- a/src/Logging/FlashMessageDump.php +++ b/src/Logging/FlashMessageDump.php @@ -8,15 +8,13 @@ class FlashMessageDump { - public static function dump(Logger $logger, Control $control, bool $clear = true): void + public static function dump(MemoryLogger $logger, Control $control, bool $clear = true): void { - if ($logger instanceof MemoryLogger) { - foreach ($logger->getMessages() as $message) { - $control->flashMessage($message->text, $message->level); - } - if ($clear) { - $logger->clear(); - } + foreach ($logger->getMessages() as $message) { + $control->flashMessage($message->text, $message->level); + } + if ($clear) { + $logger->clear(); } } } diff --git a/src/Logging/Message.php b/src/Logging/Message.php index 50ff17f..8759ce4 100644 --- a/src/Logging/Message.php +++ b/src/Logging/Message.php @@ -26,7 +26,7 @@ public function __construct(string $message, string $level) } /** - * @phpstan-return array{'text':string,'level':string} + * @phpstan-return array{text:string,level:string} */ public function __toArray(): array { diff --git a/src/Price/Price.php b/src/Price/Price.php index d0ae8ce..64fae1b 100644 --- a/src/Price/Price.php +++ b/src/Price/Price.php @@ -6,6 +6,9 @@ use Nette\SmartObject; +/** + * @phpstan-type TSerializedPrice array{currency:string,amount:float} + */ final class Price { use SmartObject; @@ -50,6 +53,9 @@ public function __toString(): string return $this->currency->format($this->amount); } + /** + * @phpstan-return TSerializedPrice + */ public function __serialize(): array { return [ diff --git a/src/UI/Navigation/NavItem.php b/src/UI/Navigation/NavItem.php index 81355ff..3683fef 100644 --- a/src/UI/Navigation/NavItem.php +++ b/src/UI/Navigation/NavItem.php @@ -12,7 +12,7 @@ class NavItem use SmartObject; public string $destination; - /** @phpstan-var array */ + /** @phpstan-var array */ public array $linkParams; public Title $title; /** @var NavItem[] */ @@ -20,7 +20,7 @@ class NavItem public bool $active; /** - * @phpstan-param array $linkParams + * @phpstan-param array $linkParams * @phpstan-param NavItem[] $children */ public function __construct(