Skip to content

Commit 33085b0

Browse files
authored
fix(view): lexing multiline attributes in windows (#1121)
1 parent 80ab136 commit 33085b0

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Tempest/View/src/Parser/TempestViewLexer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
final class TempestViewLexer
66
{
7+
private const string WHITESPACE = PHP_EOL . "\n\t\f ";
8+
79
private int $position = 0;
810

911
private ?string $current;
@@ -53,7 +55,7 @@ private function seek(int $length = 1, int $offset = 0): ?string
5355

5456
private function seekIgnoringWhitespace(int $length = 1): ?string
5557
{
56-
$offset = strspn($this->html, PHP_EOL . "\n\t\f ", $this->position);
58+
$offset = strspn($this->html, self::WHITESPACE, $this->position);
5759

5860
return $this->seek(length: $length, offset: $offset);
5961
}
@@ -107,7 +109,7 @@ private function lexTag(): array
107109
continue;
108110
}
109111

110-
$attributeName = $this->consumeWhile("\n ");
112+
$attributeName = $this->consumeWhile(self::WHITESPACE);
111113

112114
$attributeName .= $this->consumeUntil('= >');
113115

src/Tempest/View/tests/TempestViewLexerTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ public function test_closing_tag(string $tag): void
9292

9393
public function test_multiline_attributes(): void
9494
{
95-
if (PHP_OS_FAMILY === 'Windows') {
96-
$this->markTestSkipped('This test should be debugged on Windows.');
97-
/* @phpstan-ignore-next-line */
98-
return;
99-
}
100-
10195
$html = <<<'HTML'
10296
<div
10397
class="abc"

0 commit comments

Comments
 (0)