Skip to content

Commit 3c9ec5e

Browse files
author
matheo
committed
order checks to match best pratice first
1 parent 904a613 commit 3c9ec5e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/TwigComponent/src/ComponentTemplateFinder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function findAnonymousComponentTemplate(string $name): ?string
2828
$loader = $this->environment->getLoader();
2929
$componentPath = rtrim(str_replace(':', '/', $name));
3030

31-
if ($loader->exists($componentPath)) {
32-
return $componentPath;
31+
if ($loader->exists('components/'.$componentPath.'.html.twig')) {
32+
return 'components/'.$componentPath.'.html.twig';
3333
}
3434

3535
if ($loader->exists($componentPath.'.html.twig')) {
@@ -40,8 +40,8 @@ public function findAnonymousComponentTemplate(string $name): ?string
4040
return 'components/'.$componentPath;
4141
}
4242

43-
if ($loader->exists('components/'.$componentPath.'.html.twig')) {
44-
return 'components/'.$componentPath.'.html.twig';
43+
if ($loader->exists($componentPath)) {
44+
return $componentPath;
4545
}
4646

4747
return null;

0 commit comments

Comments
 (0)