Skip to content

Commit 635bb26

Browse files
committed
style: apply fixes from mago
1 parent 8a6c871 commit 635bb26

File tree

10 files changed

+33
-12
lines changed

10 files changed

+33
-12
lines changed

src/Markdown/Alerts/AlertBlockParser.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
final class AlertBlockParser implements BlockContinueParserInterface
1212
{
13-
protected $block;
14-
protected $finished = false;
13+
protected AlertBlock $block;
14+
protected bool $finished = false;
1515

1616
public function __construct(
1717
protected string $alertType,
@@ -20,25 +20,30 @@ public function __construct(
2020
$this->block = new AlertBlock($alertType, $title);
2121
}
2222

23+
#[\Override]
2324
public function addLine(string $line): void
2425
{
2526
}
2627

28+
#[\Override]
2729
public function getBlock(): AbstractBlock
2830
{
2931
return $this->block;
3032
}
3133

34+
#[\Override]
3235
public function isContainer(): bool
3336
{
3437
return true;
3538
}
3639

40+
#[\Override]
3741
public function canContain(AbstractBlock $childBlock): bool
3842
{
3943
return true;
4044
}
4145

46+
#[\Override]
4247
public function canHaveLazyContinuationLines(): bool
4348
{
4449
return false;
@@ -49,6 +54,7 @@ public function parseInlines(): bool
4954
return true;
5055
}
5156

57+
#[\Override]
5258
public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
5359
{
5460
if ($cursor->isIndented()) {
@@ -64,6 +70,7 @@ public function tryContinue(Cursor $cursor, BlockContinueParserInterface $active
6470
return BlockContinue::at($cursor);
6571
}
6672

73+
#[\Override]
6774
public function closeBlock(): void
6875
{
6976
// Nothing to do here

src/Markdown/Alerts/AlertBlockRenderer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010

1111
final class AlertBlockRenderer implements NodeRendererInterface
1212
{
13-
public function render(Node $node, ChildNodeRendererInterface $htmlRenderer)
13+
#[\Override]
14+
public function render(Node $node, ChildNodeRendererInterface $childRenderer): mixed
1415
{
1516
if (! ($node instanceof AlertBlock)) {
1617
throw new \InvalidArgumentException('Incompatible node type: ' . get_class($node));
1718
}
1819

19-
if (! ($htmlRenderer instanceof HtmlRenderer)) {
20-
throw new \InvalidArgumentException('Incompatible renderer type: ' . get_class($htmlRenderer));
20+
if (! ($childRenderer instanceof HtmlRenderer)) {
21+
throw new \InvalidArgumentException('Incompatible renderer type: ' . get_class($childRenderer));
2122
}
2223

2324
$cssClass = 'alert alert-' . $node->alertType;
@@ -26,7 +27,7 @@ public function render(Node $node, ChildNodeRendererInterface $htmlRenderer)
2627
attributes: ['class' => 'alert-wrapper'],
2728
contents: [
2829
$node->title ? new HtmlElement('span', attributes: ['class' => 'alert-title'], contents: $node->title) : null,
29-
$htmlRenderer->renderNodes($node->children()),
30+
$childRenderer->renderNodes($node->children()),
3031
],
3132
);
3233

src/Markdown/Alerts/AlertBlockStartParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
final class AlertBlockStartParser implements BlockStartParserInterface
1212
{
13+
#[\Override]
1314
public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart
1415
{
1516
if ($cursor->isIndented()) {

src/Markdown/Alerts/AlertExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
final class AlertExtension implements ExtensionInterface
99
{
10+
#[\Override]
1011
public function register(EnvironmentBuilderInterface $environment): void
1112
{
1213
$environment->addBlockStartParser(new AlertBlockStartParser());

src/Markdown/CodeBlockRenderer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public function __construct(
1919
) {
2020
}
2121

22-
public function render(Node $node, ChildNodeRendererInterface $childRenderer)
22+
#[\Override]
23+
public function render(Node $node, ChildNodeRendererInterface $childRenderer): string
2324
{
2425
if (! ($node instanceof FencedCode)) {
2526
throw new InvalidArgumentException('Block must be instance of ' . FencedCode::class);

src/Markdown/FqcnParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515
final readonly class FqcnParser implements InlineParserInterface
1616
{
17+
#[\Override]
1718
public function getMatchDefinition(): InlineParserMatch
1819
{
1920
return InlineParserMatch::regex("{`((?:\\\{1,2}\w+|\w+\\\{1,2})(?:\w+\\\{0,2})+)`}");
2021
}
2122

23+
#[\Override]
2224
public function parse(InlineParserContext $inlineContext): bool
2325
{
2426
$cursor = $inlineContext->getCursor();

src/Markdown/HandleParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
final readonly class HandleParser implements InlineParserInterface
1313
{
14+
#[\Override]
1415
public function getMatchDefinition(): InlineParserMatch
1516
{
1617
return InlineParserMatch::regex('{(twitter|x|bluesky|bsky|gh|github):(.+?)(?:,(.+))?}');
1718
}
1819

20+
#[\Override]
1921
public function parse(InlineParserContext $inlineContext): bool
2022
{
2123
$cursor = $inlineContext->getCursor();

src/Markdown/TempestPackageParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313
final readonly class TempestPackageParser implements InlineParserInterface
1414
{
15+
#[\Override]
1516
public function getMatchDefinition(): InlineParserMatch
1617
{
1718
return InlineParserMatch::regex("{`tempest\\/([\w-]+)`}");
1819
}
1920

21+
#[\Override]
2022
public function parse(InlineParserContext $inlineContext): bool
2123
{
2224
$cursor = $inlineContext->getCursor();

src/Web/Documentation/show.view.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
<!-- Chapter list -->
1818
<ul class="flex flex-col border-s border-(--ui-border)">
1919
<li :foreach="$this->chaptersForCategory($category) as $chapter" class="-ms-px ps-1.5">
20-
<a :href="$chapter->getUri()" class="group relative w-full px-2.5 py-1.5 flex items-center gap-1.5 text-sm focus:outline-none focus-visible:outline-none hover:text-(--ui-text-highlighted) data-[state=open]:text-(--ui-text-highlighted) transition-colors <?= $this->isCurrent(
21-
$chapter,
22-
)
23-
? 'text-(--ui-primary) after:absolute after:-left-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full after:transition-colors after:bg-(--ui-primary)'
24-
: 'text-(--ui-text-muted)' ?>">
20+
<a
21+
:href="$chapter->getUri()"
22+
class="
23+
group relative w-full px-2.5 py-1.5 flex items-center gap-1.5 text-sm focus:outline-none focus-visible:outline-none hover:text-(--ui-text-highlighted) data-[state=open]:text-(--ui-text-highlighted) transition-colors
24+
<?= $this->isCurrent($chapter)
25+
? 'text-(--ui-primary) after:absolute after:-left-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full after:transition-colors after:bg-(--ui-primary)'
26+
: 'text-(--ui-text-muted)' ?>
27+
">
2528
{{ $chapter->title }}
2629
</a>
2730
</li>

src/Web/Meta/x-meta-image.view.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
use function Tempest\uri;
3+
34
?>
45

56
<x-component name="x-meta-image">

0 commit comments

Comments
 (0)