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 3939#[AsCommand(name: 'lint:twig ' , description: 'Lint a Twig template and outputs encountered errors ' )]
4040class LintCommand extends Command
4141{
42+ protected string |array $ namePatterns ;
4243 private Environment $ twig ;
4344 private string $ format ;
4445
45- public function __construct (Environment $ twig )
46+ public function __construct (Environment $ twig, string | array $ namePatterns = [ ' *.twig ' ] )
4647 {
4748 parent ::__construct ();
4849
4950 $ this ->twig = $ twig ;
51+ $ this ->namePatterns = $ namePatterns ;
5052 }
5153
5254 protected function configure ()
@@ -146,7 +148,7 @@ protected function findFiles(string $filename)
146148 if (is_file ($ filename )) {
147149 return [$ filename ];
148150 } elseif (is_dir ($ filename )) {
149- return Finder::create ()->files ()->in ($ filename )->name (' *.twig ' );
151+ return Finder::create ()->files ()->in ($ filename )->name ($ this -> namePatterns );
150152 }
151153
152154 throw new RuntimeException (sprintf ('File or directory "%s" is not readable. ' , $ filename ));
You can’t perform that action at this time.
0 commit comments