Skip to content

Commit

Permalink
PHPDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
cevro committed Aug 15, 2023
1 parent 4fcf013 commit 5d3f8e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/Logging/FlashMessageDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
2 changes: 1 addition & 1 deletion src/Logging/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 6 additions & 0 deletions src/Price/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Nette\SmartObject;

/**
* @phpstan-type TSerializedPrice array{currency:string,amount:float}
*/
final class Price
{
use SmartObject;
Expand Down Expand Up @@ -50,6 +53,9 @@ public function __toString(): string
return $this->currency->format($this->amount);
}

/**
* @phpstan-return TSerializedPrice
*/
public function __serialize(): array
{
return [
Expand Down
4 changes: 2 additions & 2 deletions src/UI/Navigation/NavItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class NavItem
use SmartObject;

public string $destination;
/** @phpstan-var array<string,int|string|bool> */
/** @phpstan-var array<string,scalar> */
public array $linkParams;
public Title $title;
/** @var NavItem[] */
public array $children;
public bool $active;

/**
* @phpstan-param array<string,int|string|bool> $linkParams
* @phpstan-param array<string,scalar> $linkParams
* @phpstan-param NavItem[] $children
*/
public function __construct(
Expand Down

0 comments on commit 5d3f8e7

Please sign in to comment.