For more information about this repository, visit the project page at https://www.drupal.org/project/twig_tweak
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
798 B
38 lines
798 B
<?php |
|
|
|
namespace Drupal\twig_tweak\Command; |
|
|
|
use Symfony\Component\Finder\Finder; |
|
|
|
/** |
|
* Implements twig-tweak:lint console command. |
|
*/ |
|
final class TwigLintCommand extends LintCommand { |
|
|
|
/** |
|
* {@inheritdoc} |
|
*/ |
|
protected static $defaultName = 'twig-tweak:validate'; |
|
|
|
/** |
|
* {@inheritdoc} |
|
*/ |
|
protected function configure(): void { |
|
|
|
if (!\class_exists(Finder::class)) { |
|
throw new \LogicException('To validate Twig templates you must install symfony/finder component.'); |
|
} |
|
|
|
parent::configure(); |
|
$this->setAliases(['twig-validate']); |
|
|
|
$help = <<< 'TEXT' |
|
|
|
This command only validates Twig Syntax. For checking code style |
|
consider using <info>friendsoftwig/twigcs</info> package. |
|
TEXT; |
|
|
|
$this->setHelp($this->getHelp() . $help); |
|
} |
|
|
|
}
|
|
|