diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 46348b01..e981c29f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,35 @@ parameters: ignoreErrors: + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseItemList\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseItemList.php + + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseItemTable\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseItemTable.php + + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseListItem\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseListItem.php + + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseOrderedItemList\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseOrderedItemList.php + + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseStatusBar\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseStatusBar.php + + - + message: "#^Method ipl\\\\Web\\\\Common\\\\BaseTableRowItem\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Common/BaseTableRowItem.php + - message: "#^Method ipl\\\\Web\\\\Common\\\\Card\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 @@ -1695,6 +1725,11 @@ parameters: count: 1 path: src/Widget/Dropdown.php + - + message: "#^Method ipl\\\\Web\\\\Widget\\\\EmptyState\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Widget/EmptyState.php + - message: "#^Method ipl\\\\Web\\\\Widget\\\\HorizontalKeyValue\\:\\:__construct\\(\\) has parameter \\$key with no type specified\\.$#" count: 1 @@ -1775,6 +1810,26 @@ parameters: count: 1 path: src/Widget/Link.php + - + message: "#^Method ipl\\\\Web\\\\Widget\\\\Notice\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Widget/Notice.php + + - + message: "#^Method ipl\\\\Web\\\\Widget\\\\PageSeparatorItem\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Widget/PageSeparatorItem.php + + - + message: "#^Method ipl\\\\Web\\\\Widget\\\\ShowMore\\:\\:assemble\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Widget/ShowMore.php + + - + message: "#^Method ipl\\\\Web\\\\Widget\\\\ShowMore\\:\\:getBaseTarget\\(\\) should return string\\|null but returns array\\|bool\\|string\\|null\\.$#" + count: 1 + path: src/Widget/ShowMore.php + - message: "#^Method ipl\\\\Web\\\\Widget\\\\StateBadge\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 diff --git a/src/Common/BaseItemList.php b/src/Common/BaseItemList.php index 85e4c964..85240fb5 100644 --- a/src/Common/BaseItemList.php +++ b/src/Common/BaseItemList.php @@ -15,13 +15,14 @@ abstract class BaseItemList extends BaseHtmlElement { use BaseFilter; + /** @var string[] */ protected $baseAttributes = [ 'class' => 'item-list', 'data-base-target' => '_next', 'data-pdfexport-page-breaks-at' => '.list-item' ]; - /** @var iterable */ + /** @var iterable */ protected $data; /** @var bool Whether the list contains at least one item with an icon_image */ @@ -32,7 +33,7 @@ abstract class BaseItemList extends BaseHtmlElement /** * Create a new item list * - * @param iterable $data Data source of the list + * @param iterable $data Data source of the list */ public function __construct($data) { @@ -62,10 +63,14 @@ public function hasIconImages(): bool * Set whether the list contains at least one item with an icon_image * * @param bool $hasIconImages + * + * @return $this */ - public function setHasIconImages(bool $hasIconImages) + public function setHasIconImages(bool $hasIconImages): self { $this->hasIconImages = $hasIconImages; + + return $this; } /** @@ -73,7 +78,7 @@ public function setHasIconImages(bool $hasIconImages) * * If you want to adjust the item list after construction, override this method. */ - protected function init() + protected function init(): void { } diff --git a/src/Common/BaseItemTable.php b/src/Common/BaseItemTable.php index 64436f52..c82a335b 100644 --- a/src/Common/BaseItemTable.php +++ b/src/Common/BaseItemTable.php @@ -17,12 +17,13 @@ abstract class BaseItemTable extends BaseHtmlElement /** @var string Defines the layout used by this item */ public const TABLE_LAYOUT = 'table-layout'; + /** @var string[] */ protected $baseAttributes = [ 'class' => 'item-table', 'data-base-target' => '_next' ]; - /** @var iterable */ + /** @var iterable */ protected $data; protected $tag = 'ul'; @@ -30,7 +31,7 @@ abstract class BaseItemTable extends BaseHtmlElement /** * Create a new item table * - * @param iterable $data Data source of the table + * @param iterable $data Data source of the table */ public function __construct($data) { @@ -50,7 +51,7 @@ public function __construct($data) * * If you want to adjust the item table after construction, override this method. */ - protected function init() + protected function init(): void { } diff --git a/src/Common/BaseListItem.php b/src/Common/BaseListItem.php index 66eb1491..03800567 100644 --- a/src/Common/BaseListItem.php +++ b/src/Common/BaseListItem.php @@ -11,6 +11,7 @@ */ abstract class BaseListItem extends BaseHtmlElement { + /** @var string[] */ protected $baseAttributes = ['class' => 'list-item']; /** @var object The associated list item */ @@ -19,6 +20,7 @@ abstract class BaseListItem extends BaseHtmlElement /** @var BaseItemList The list where the item is part of */ protected $list; + /** @var string */ protected $tag = 'li'; /** @@ -37,27 +39,27 @@ public function __construct($item, BaseItemList $list) $this->init(); } - abstract protected function assembleHeader(BaseHtmlElement $header); + abstract protected function assembleHeader(BaseHtmlElement $header): void; - abstract protected function assembleMain(BaseHtmlElement $main); + abstract protected function assembleMain(BaseHtmlElement $main): void; - protected function assembleFooter(BaseHtmlElement $footer) + protected function assembleFooter(BaseHtmlElement $footer): void { } - protected function assembleCaption(BaseHtmlElement $caption) + protected function assembleCaption(BaseHtmlElement $caption): void { } - protected function assembleIconImage(BaseHtmlElement $iconImage) + protected function assembleIconImage(BaseHtmlElement $iconImage): void { } - protected function assembleTitle(BaseHtmlElement $title) + protected function assembleTitle(BaseHtmlElement $title): void { } - protected function assembleVisual(BaseHtmlElement $visual) + protected function assembleVisual(BaseHtmlElement $visual): void { } @@ -100,7 +102,7 @@ protected function createFooter(): BaseHtmlElement /** * @return ?BaseHtmlElement */ - protected function createIconImage() + protected function createIconImage(): ?BaseHtmlElement { if (! $this->list->hasIconImages()) { return null; @@ -115,8 +117,9 @@ protected function createIconImage() return $iconImage; } - protected function createTimestamp() + protected function createTimestamp(): ?BaseHtmlElement { + return null; } protected function createTitle(): BaseHtmlElement @@ -145,7 +148,7 @@ protected function createVisual() * * If you want to adjust the list item after construction, override this method. */ - protected function init() + protected function init(): void { } diff --git a/src/Common/BaseStatusBar.php b/src/Common/BaseStatusBar.php index 4fe96cdf..82311594 100644 --- a/src/Common/BaseStatusBar.php +++ b/src/Common/BaseStatusBar.php @@ -5,24 +5,27 @@ use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; +use ipl\Orm\Model; use ipl\Stdlib\BaseFilter; abstract class BaseStatusBar extends BaseHtmlElement { use BaseFilter; + /** @var Model */ protected $summary; protected $tag = 'div'; + /** @var string[] */ protected $defaultAttributes = ['class' => 'status-bar']; - public function __construct($summary) + public function __construct(Model $summary) { $this->summary = $summary; } - abstract protected function assembleTotal(BaseHtmlElement $total); + abstract protected function assembleTotal(BaseHtmlElement $total): void; abstract protected function createStateBadges(): BaseHtmlElement; diff --git a/src/Common/BaseTableRowItem.php b/src/Common/BaseTableRowItem.php index ec9689c5..459f2681 100644 --- a/src/Common/BaseTableRowItem.php +++ b/src/Common/BaseTableRowItem.php @@ -10,6 +10,7 @@ abstract class BaseTableRowItem extends BaseHtmlElement { + /** @var string[] */ protected $baseAttributes = ['class' => 'table-row']; /** @var object The associated list item */ @@ -40,16 +41,23 @@ public function __construct($item, BaseItemTable $table = null) $this->init(); } - abstract protected function assembleTitle(BaseHtmlElement $title); + abstract protected function assembleTitle(BaseHtmlElement $title): void; - protected function assembleColumns(HtmlDocument $columns) + protected function assembleColumns(HtmlDocument $columns): void { } - protected function assembleVisual(BaseHtmlElement $visual) + protected function assembleVisual(BaseHtmlElement $visual): void { } + /** + * Create column + * + * @param mixed $content + * + * @return BaseHtmlElement + */ protected function createColumn($content = null): BaseHtmlElement { return new HtmlElement( @@ -100,7 +108,7 @@ protected function createVisual() * * If you want to adjust the list item after construction, override this method. */ - protected function init() + protected function init(): void { } diff --git a/src/Common/ListItemCommonLayout.php b/src/Common/ListItemCommonLayout.php index 8d73d3f5..dadd8c55 100644 --- a/src/Common/ListItemCommonLayout.php +++ b/src/Common/ListItemCommonLayout.php @@ -8,13 +8,13 @@ trait ListItemCommonLayout { use CaptionDisabled; - protected function assembleHeader(BaseHtmlElement $header) + protected function assembleHeader(BaseHtmlElement $header): void { $header->addHtml($this->createTitle()); $header->add($this->createTimestamp()); } - protected function assembleMain(BaseHtmlElement $main) + protected function assembleMain(BaseHtmlElement $main): void { $main->addHtml($this->createHeader()); if (! $this->isCaptionDisabled()) { diff --git a/src/Widget/EmptyState.php b/src/Widget/EmptyState.php index ab93d0bd..4352b32f 100644 --- a/src/Widget/EmptyState.php +++ b/src/Widget/EmptyState.php @@ -11,8 +11,14 @@ class EmptyState extends BaseHtmlElement protected $tag = 'div'; + /** @var string[] */ protected $defaultAttributes = ['class' => 'empty-state']; + /** + * Create an empty state + * + * @param mixed $content + */ public function __construct($content) { $this->content = $content; diff --git a/src/Widget/Notice.php b/src/Widget/Notice.php index 3e67f111..ef84e05a 100644 --- a/src/Widget/Notice.php +++ b/src/Widget/Notice.php @@ -12,8 +12,14 @@ class Notice extends BaseHtmlElement protected $tag = 'p'; + /** @var string[] */ protected $defaultAttributes = ['class' => 'notice']; + /** + * Create a html notice + * + * @param mixed $content + */ public function __construct($content) { $this->content = $content; diff --git a/src/Widget/ShowMore.php b/src/Widget/ShowMore.php index df6bafc0..a34f2272 100644 --- a/src/Widget/ShowMore.php +++ b/src/Widget/ShowMore.php @@ -11,14 +11,18 @@ class ShowMore extends BaseHtmlElement { use BaseTarget; + /** @var string[] */ protected $defaultAttributes = ['class' => 'show-more']; protected $tag = 'div'; + /** @var ResultSet */ protected $resultSet; + /** @var Url */ protected $url; + /** @var ?string */ protected $label; public function __construct(ResultSet $resultSet, Url $url, string $label = null)