Skip to content

Commit 7a5de0d

Browse files
committed
setup and run pint
1 parent 4469d60 commit 7a5de0d

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

pint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"preset": "psr12"
3+
}

src/Ast/Node.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public function __construct(
1010
public array $attributes = [],
1111
public array $children = [],
1212
public string $content = ''
13-
)
14-
{
13+
) {
1514
}
1615
}

src/Ast/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function parseElement(): Node
9090
return new Node(NodeType::ELEMENT, $tagName, $attributes, []);
9191
}
9292
// Otherwise, expect a TAG_END for the opening tag.
93-
else if ($nextToken && $nextToken->type === TokenType::TAG_END) {
93+
elseif ($nextToken && $nextToken->type === TokenType::TAG_END) {
9494
$this->advance(); // Consume the TAG_END for the opening tag.
9595

9696
// Check if this is a raw element (like script or style).

src/Lexer/Lexer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ protected function consumeTag(): void
188188
if (in_array($lowerTag, $this->voidElements)) {
189189
if ($this->lookAhead('/>')) {
190190
$this->consume(2);
191-
} else if ($this->peek() === '>') {
191+
} elseif ($this->peek() === '>') {
192192
$this->consume();
193193
}
194194
$this->addToken(TokenType::TAG_SELF_CLOSE);
195195
} else {
196196
if ($this->lookAhead('/>')) {
197197
$this->consume(2);
198198
$this->addToken(TokenType::TAG_SELF_CLOSE);
199-
} else if ($this->peek() === '>') {
199+
} elseif ($this->peek() === '>') {
200200
$this->consume();
201201
$this->addToken(TokenType::TAG_END);
202202
}

src/Lexer/Token.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
public function __construct(
88
public TokenType $type,
99
public string $value,
10-
)
11-
{}
12-
}
10+
) {
11+
}
12+
}

tests/Feature/AstTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@
7979
->toBeInstanceOf(Node::class)
8080
->toHaveKey('type', NodeType::RAW);
8181

82-
});
82+
});

tests/Feature/LexerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
expect($tokens[13])
7373
->toHaveKey('type', TokenType::COMMENT)
7474
->toHaveKey('value', ' Body ');
75-
});
75+
});

tests/Feature/PrintTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@
7070
$lexer = new Lexer($html);
7171
$nodes = Parser::make($lexer->lex())->parse();
7272
expect(Printer::make()->render($nodes))->toEqual(
73-
<<<HTML
73+
<<<HTML
7474
<img src="logo.png" alt="logo" />
7575
<img src="logo.png" alt="logo" />
7676
<img src="logo.png" alt="logo" />
7777
<br />
7878
<br />
7979
<br />
8080
HTML
81-
8281
);
83-
});
82+
});

0 commit comments

Comments
 (0)