8000 minor #57608 [TwigBridge] Remove random file name for `lint:twig` out… · symfony/symfony@0fde17e · GitHub
[go: up one dir, main page]

Skip to content

Commit 0fde17e

Browse files
minor #57608 [TwigBridge] Remove random file name for lint:twig output in case of error (GromNaN)
This PR was merged into the 7.2 branch. Discussion ---------- [TwigBridge] Remove random file name for `lint:twig` output in case of error | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Part of #57588 | License | MIT In the `lint:twig`, `uniqid` is used to generate a file name when linting a template from STDIN. - I don't find any reason to use a unique file name. The file name is never stored when the template is tokenized and compiled. The cache is not used. - This meaningless file name is displayed in the output in case of error, which is better replaced by the text "Standard Input". Before: ``` $ bin/console lint:twig - < vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig ERROR in sf_6681e2dd64a2e2.02015003 (line -1) >> The "inky_to_html" filter is part of the InkyExtension, which is not installed/enabled; try running "composer require twig/inky-extra". [WARNING] 0 Twig files have valid syntax and 1 contain errors. ``` After: ``` $ bin/console lint:twig - < vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig ERROR in Standard Input (line -1) >> The "inky_to_html" filter is part of the InkyExtension, which is not installed/enabled; try running "composer require twig/inky-extra". [WARNING] 0 Twig files have valid syntax and 1 contain errors. ``` Note: the `line -1` is due to the lack of context provided to `Twig\Extra\TwigExtraBundle\MissingExtensionSuggestor::suggestFilter()` For reference, this was introduced by #10843 Commits ------- a97acbd Remove random file name for lint:twig output in case of error
2 parents 8a4899d + a97acbd commit 0fde17e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8989
$this->format = $input->getOption('format') ?? (GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt');
9090

9191
if (['-'] === $filenames) {
92-
return $this->display($input, $output, $io, [$this->validate(file_get_contents('php://stdin'), uniqid('sf_', true))]);
92+
return $this->display($input, $output, $io, [$this->validate(file_get_contents('php://stdin'), 'Standard Input')]);
9393
}
9494

9595
if (!$filenames) {

0 commit comments

Comments
 (0)
0