Skip to content

Commit 7b14476

Browse files
committed
Add type hints
1 parent f242b21 commit 7b14476

File tree

1 file changed

+11
-44
lines changed

1 file changed

+11
-44
lines changed

src/HtmlCard.php

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ class HtmlCard extends Card
99
{
1010
/**
1111
* The width of the card (1/3, 1/2, or full).
12-
*
1312
* @var string
1413
*/
1514
public $width = '1/3';
1615

1716
/**
1817
* Create a new element.
19-
*
2018
* @param string|null $component
2119
*/
2220
public function __construct($component = null)
@@ -37,26 +35,14 @@ public function component()
3735
return 'html-card';
3836
}
3937

40-
/**
41-
* Set HTML code to display in a card
42-
*
43-
* @param string $htmlContent
44-
*
45-
* @return HtmlCard
46-
*/
47-
public function html(string $htmlContent)
38+
/** Set HTML code to display in a card. */
39+
public function html(string $htmlContent): static
4840
{
4941
return $this->withMeta(['content' => $htmlContent]);
5042
}
5143

52-
/**
53-
* Set Markdown code to display in a card (converted into HTML)
54-
*
55-
* @param string $htmlContent
56-
*
57-
* @return HtmlCard
58-
*/
59-
public function markdown(string $markdownContent)
44+
/** Set Markdown code to display in a card (converted into HTML). */
45+
public function markdown(string $markdownContent): static
6046
{
6147
$htmlContent = App::make(MarkdownConverter::class)::parse($markdownContent)->toHtml();
6248

@@ -65,27 +51,18 @@ public function markdown(string $markdownContent)
6551

6652
/**
6753
* Use blade view file to render Card content.
68-
*
6954
* @param string $view
70-
* @param array $viewData
71-
*
72-
* @return HtmlCard
55+
* @param array<string, mixed> $viewData
7356
*/
74-
public function view(string $view, array $viewData = [])
57+
public function view(string $view, array $viewData = []): static
7558
{
7659
$htmlContent = view($view, $viewData)->render();
7760

7861
return $this->html($htmlContent);
7962
}
8063

81-
/**
82-
* Center card's content
83-
*
84-
* @param bool $centerContent
85-
*
86-
* @return HtmlCard
87-
*/
88-
public function center(bool $centerContent = true)
64+
/** Center card's content. */
65+
public function center(bool $centerContent = true): static
8966
{
9067
return $this->withMeta(['center' => $centerContent]);
9168
}
@@ -96,24 +73,14 @@ public function center(bool $centerContent = true)
9673
* full-width cards at the bottom. If you want to display full-width cards
9774
* not at the end, you should use with=1/3 or 2/3 and this method.
9875
* @see https://github.com/laravel/nova-issues/issues/1895#issuecomment-543684472
99-
*
100-
* @param bool $forceFullWidth
101-
*
102-
* @return HtmlCard
10376
*/
104-
public function forceFullWidth(bool $forceFullWidth = true)
77+
public function forceFullWidth(bool $forceFullWidth = true): static
10578
{
10679
return $this->withMeta(['forceFullWidth' => $forceFullWidth]);
10780
}
10881

109-
/**
110-
* Whether to use standard Nova Card styles for a card (background, padding, etc)
111-
*
112-
* @param bool $withoutStyles
113-
*
114-
* @return HtmlCard
115-
*/
116-
public function withoutCardStyles(bool $withoutStyles = true)
82+
/** Whether to use standard Nova Card styles for a card (background, padding, etc). */
83+
public function withoutCardStyles(bool $withoutStyles = true): static
11784
{
11885
return $this->withMeta(['withoutCardStyles' => $withoutStyles]);
11986
}

0 commit comments

Comments
 (0)