Skip to content

Commit

Permalink
Make twig-bridge optional
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Oct 6, 2023
1 parent 5aa461f commit 2c202af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"composer-runtime-api": "^2.0.0",
"symfony/console": "^5.4.9 || ^6.0",
"symfony/finder": "^5.4 || ^6.0",
"symfony/twig-bridge": "^5.4 || ^6.0",
"twig/twig": "^2.14.0 || ^3.0.5",
"webmozart/assert": "^1.10"
},
Expand All @@ -38,6 +37,7 @@
"rector/rector": "^0.17.0",
"symfony/filesystem": "^5.4 || ^6.0",
"symfony/process": "^5.4 || ^6.0",
"symfony/twig-bridge": "^5.4 || ^6.0",
"symfony/ux-twig-component": "^2.8.0",
"twig/cache-extra": "^3.2",
"vimeo/psalm": "^5.2.0"
Expand Down
21 changes: 15 additions & 6 deletions src/Environment/StubbedEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,22 @@ public function __construct(
) {
parent::__construct(new ArrayLoader());

$this->addTokenParser(new DumpTokenParser());
$this->addTokenParser(new FormThemeTokenParser());
$this->addTokenParser(new StopwatchTokenParser(true));
$this->addTokenParser(new TransDefaultDomainTokenParser());
$this->addTokenParser(new TransTokenParser());

// Optional dependency
if (class_exists(DumpTokenParser::class)) {
$this->addTokenParser(new DumpTokenParser());
}
if (class_exists(FormThemeTokenParser::class)) {
$this->addTokenParser(new FormThemeTokenParser());
}
if (class_exists(StopwatchTokenParser::class)) {
$this->addTokenParser(new StopwatchTokenParser(true));
}
if (class_exists(TransDefaultDomainTokenParser::class)) {
$this->addTokenParser(new TransDefaultDomainTokenParser());
}
if (class_exists(TransTokenParser::class)) {
$this->addTokenParser(new TransTokenParser());
}
if (class_exists(CacheTokenParser::class)) {
$this->addTokenParser(new CacheTokenParser());
}
Expand Down

0 comments on commit 2c202af

Please sign in to comment.