8000 [Twig] Decouple Twig commands from the Famework by GromNaN · Pull Request #9855 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Twig] Decouple Twig commands from the Famework #9855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed getTwig for the command as it was unecessary
  • Loading branch information
GromNaN committed Dec 29, 2013
commit d500749f45b185410ed64e1251b474effbca3465
13 changes: 2 additions & 11 deletions src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
$twig = $this->getTwig();
$template = null;
$filename = $input->getArgument('filename');

Expand All @@ -85,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$template .= fread(STDIN, 1024);
}

return $this->validateTemplate($twig, $output, $template);
return $this->validateTemplate($this->twig, $output, $template);
}

if (0 !== strpos($filename, '@') && !is_readable($filename)) {
Expand All @@ -104,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$errors = 0;
foreach ($files as $file) {
$errors += $this->validateTemplate($twig, $output, file_get_contents($file), $file);
$errors += $this->validateTemplate($this->twig, $output, file_get_contents($file), $file);
}

return $errors > 0 ? 1 : 0;
Expand Down Expand Up @@ -163,12 +162,4 @@ protected function getContext($template, $line, $context = 3)

return $result;
}

/**
* @return \Twig_Environment
*/
protected function getTwig()
{
return $this->twig;
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/TwigBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CHANGELOG
2.5.0
-----

* moved `LintCommand` to the Twig bridge and register it as a service
* moved `LintCommand` to the Twig bridge and registered it as a service

2.3.0
-----
Expand Down
0