From 6f0e4308040ec28d7ccdf0ed3017c6f59e889c11 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Tue, 15 Sep 2026 04:24:24 +0200 Subject: [PATCH] Recognise a semicolon-terminated example heredoc as documented usage InternalComponentsTest strips a showcase example's <<<'BLADE' heredoc before checking that a package view only ever refers to its own components through the livewire-material:: namespace, since an example heredoc documents an application's own (unprefixed) usage. The check only recognised an array's BLADE, terminator; the Layout section's three dedicated pages (plan step 38) assign their one example to $code with BLADE; instead, which the check now strips too. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- tests/Feature/InternalComponentsTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Feature/InternalComponentsTest.php b/tests/Feature/InternalComponentsTest.php index 8b8c48d5..9a8da0ce 100644 --- a/tests/Feature/InternalComponentsTest.php +++ b/tests/Feature/InternalComponentsTest.php @@ -26,8 +26,10 @@ it('refers to its own components through its namespace, which no prefix or app c ->filter(fn (SplFileInfo $file): bool => str_ends_with($file->getFilename(), '.blade.php')) ->flatMap(function (SplFileInfo $file) use ($names): array { // Comments document usage as an application writes it, and the showcase's examples - // are that usage; neither is compiled as the package's own markup. - $source = preg_replace(['/\{\{--.*?--\}\}/s', "/<<<'BLADE'.*?^\\s*BLADE,/sm"], '', $file->getContents()); + // are that usage; neither is compiled as the package's own markup. An example heredoc + // ends `BLADE,` as an array's value (most sections) or `BLADE;` assigned to its own + // variable (a Layout page with a single example of its own, plan step 38). + $source = preg_replace(['/\{\{--.*?--\}\}/s', "/<<<'BLADE'.*?^\\s*BLADE[,;]/sm"], '', $file->getContents()); preg_match_all('/<\/?x-('.$names.')(?=[\s\/>])/', $source, $matches);