Repository: tighten/tlint (php)

Issue:
Add option to ignore excaped braces for SpacesAroundBladeRenderContent
I'm rendering available placeholders into blade using the following, escaping blade's processing via [the documented method](https://laravel.com/docs/11.x/blade#blade-and-javascript-frameworks):
```html
Placeholders:
<ul>
    <li><code>@@{{PROJECT_MANAGER_NAME}}</code>: The name of the project manager.</li>
</ul>
```

Which gives me, this:
![image](https://github.com/user-attachments/assets/6c24be3b-c38c-46b9-9445-94806b7ba35e)

This is all good until tlint thows the error `Spaces around blade rendered content`.

Is it possible to configure the *SpacesAroundBladeRenderContent* rule to ignore escaped braces?

Pull request:
Ignore escaped blade on `SpacesAroundBladeRenderContent` linters and formatters
This PR updates the `SpacesAroundBladeRenderContent` linters and formatters to ignore escaped blade.

Closes #368 

Patch:
diff --git a/src/Linters/SpacesAroundBladeRenderContent.php b/src/Linters/SpacesAroundBladeRenderContent.php
index 88a65f5..621d557 100644
--- a/src/Linters/SpacesAroundBladeRenderContent.php
+++ b/src/Linters/SpacesAroundBladeRenderContent.php
@@ -14,9 +14,9 @@ class SpacesAroundBladeRenderContent extends BaseLinter
     public const DESCRIPTION = 'Spaces around blade rendered content:'
         . '`{{1 + 1}}` -> `{{ 1 + 1 }}`';
 
-    public const SEARCH_NORMAL = '/\{\{\s*(.+?)\s*\}\}/';
+    public const SEARCH_NORMAL = '/(?<!@)\{\{\s*(.+?)\s*\}\}/';
 
-    public const SEARCH_RAW = '/\{\!\!\s*(.+?)\s*\!\!\}/';
+    public const SEARCH_RAW = '/(?<!@)\{\!\!\s*(.+?)\s*\!\!\}/';
 
     public function lint(Parser $parser)
     {


Test patch:
diff --git a/tests/Formatting/Formatters/SpacesAroundBladeRenderContentTest.php b/tests/Formatting/Formatters/SpacesAroundBladeRenderContentTest.php
index 0ddf569..0d639fa 100644
--- a/tests/Formatting/Formatters/SpacesAroundBladeRenderContentTest.php
+++ b/tests/Formatting/Formatters/SpacesAroundBladeRenderContentTest.php
@@ -189,4 +189,19 @@ file;
 
         $this->assertEquals($correctlyFormatted, $formatted);
     }
+
+    /** @test */
+    public function does_not_trigger_on_escaped_blade()
+    {
+        $file = <<<'file'
+            @{{NOT_BLADE}}
+            @{!!NOT_BLADE!!}
+            file;
+
+        $formatted = (new TFormat)->format(
+            new SpacesAroundBladeRenderContent($file)
+        );
+
+        $this->assertEquals($file, $formatted);
+    }
 }
diff --git a/tests/Linting/Linters/SpacesAroundBladeRenderContentTest.php b/tests/Linting/Linters/SpacesAroundBladeRenderContentTest.php
index a6757da..963892e 100644
--- a/tests/Linting/Linters/SpacesAroundBladeRenderContentTest.php
+++ b/tests/Linting/Linters/SpacesAroundBladeRenderContentTest.php
@@ -121,4 +121,19 @@ class SpacesAroundBladeRenderContentTest extends TestCase
 
         $this->assertEmpty($lints);
     }
+
+    /** @test */
+    public function does_not_trigger_on_escaped_blade()
+    {
+        $file = <<<'file'
+            @{{NOT_BLADE}}
+            @{!!NOT_BLADE!!}
+            file;
+
+        $lints = (new TLint)->lint(
+            new SpacesAroundBladeRenderContent($file)
+        );
+
+        $this->assertEmpty($lints);
+    }
 }