Skip to content

Commit

Permalink
Merge pull request #353 from tighten/drift/allow-fqcn-in-views
Browse files Browse the repository at this point in the history
Allow blade files to have FQCN
  • Loading branch information
driftingly authored Jan 5, 2024
2 parents 9471884 + 1f1e198 commit 27ccf82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Linters/QualifiedNamesOnlyForClassName.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class QualifiedNamesOnlyForClassName extends BaseLinter

public function lint(Parser $parser)
{
if (preg_match('/\.blade\.php$/i', $this->filename)) {
return [];
}

$traverser = new NodeTraverser;

$fqcnExtends = new FindingVisitor(function (Node $node) {
Expand Down
14 changes: 14 additions & 0 deletions tests/Linting/Linters/QualifiedNamesOnlyForClassNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,18 @@ public function dispatchStripeEvent(Request \$request)

$this->assertEmpty($lints);
}

/** @test */
public function does_not_trigger_on_blade_files()
{
$file = <<<'file'
<?php $propertyTypeOptions = array_merge(['' => 'Select a property type'], App\Models\Property::$types); ?>
file;

$lints = (new TLint)->lint(
new QualifiedNamesOnlyForClassName($file, '.blade.php')
);

$this->assertEmpty($lints);
}
}

0 comments on commit 27ccf82

Please sign in to comment.