Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c37015

Browse files
committed
minor #45941 [TwigBridge] Make LintCommand::$namePatterns private (nicolas-grekas)
This PR was merged into the 6.1 branch. Discussion ---------- [TwigBridge] Make LintCommand::$namePatterns private | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Dunno why this wasn't done in #45845. /cc `@GromNaN` any idea? Commits ------- 627a296 [TwigBridge] Make LintCommand::$namePatterns private
2 parents 1b75cc0 + 627a296 commit 9c37015

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@
3939
#[AsCommand(name: 'lint:twig', description: 'Lint a Twig template and outputs encountered errors')]
4040
class LintCommand extends Command
4141
{
42-
protected string|array $namePatterns;
43-
private Environment $twig;
4442
private string $format;
4543

46-
public function __construct(Environment $twig, string|array $namePatterns = ['*.twig'])
47-
{
44+
public function __construct(
45+
private Environment $twig,
46+
private array $namePatterns = ['*.twig'],
47+
) {
4848
parent::__construct();
49-
50-
$this->twig = $twig;
51-
$this->namePatterns = $namePatterns;
5249
}
5350

5451
protected function configure()

src/Symfony/Bundle/TwigBundle/Command/LintCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand;
1515
use Symfony\Component\Console\Attribute\AsCommand;
16-
use Symfony\Component\Finder\Finder;
1716

1817
/**
1918
* Command that will validate your template syntax and output encountered errors.
@@ -47,9 +46,7 @@ protected function configure()
4746
protected function findFiles(string $filename): iterable
4847
{
4948
if (str_starts_with($filename, '@')) {
50-
$dir = $this->getApplication()->getKernel()->locateResource($filename);
51-
52-
return Finder::create()->files()->in($dir)->name($this->namePatterns);
49+
$filename = $this->getApplication()->getKernel()->locateResource($filename);
5350
}
5451

5552
return parent::findFiles($filename);

0 commit comments

Comments
 (0)