File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 39
39
#[AsCommand(name: 'lint:twig ' , description: 'Lint a Twig template and outputs encountered errors ' )]
40
40
class LintCommand extends Command
41
41
{
42
+ protected string |array $ namePatterns ;
42
43
private Environment $ twig ;
43
44
private string $ format ;
44
45
45
- public function __construct (Environment $ twig )
46
+ public function __construct (Environment $ twig, string | array $ namePatterns = [ ' *.twig ' ] )
46
47
{
47
48
parent ::__construct ();
48
49
49
50
$ this ->twig = $ twig ;
51
+ $ this ->namePatterns = $ namePatterns ;
50
52
}
51
53
52
54
protected function configure ()
@@ -146,7 +148,7 @@ protected function findFiles(string $filename)
146
148
if (is_file ($ filename )) {
147
149
return [$ filename ];
148
150
} elseif (is_dir ($ filename )) {
149
- return Finder::create ()->files ()->in ($ filename )->name (' *.twig ' );
151
+ return Finder::create ()->files ()->in ($ filename )->name ($ this -> namePatterns );
150
152
}
151
153
152
154
throw new RuntimeException (sprintf ('File or directory "%s" is not readable. ' , $ filename ));
You can’t perform that action at this time.
0 commit comments