8000 [TwigBundle] added support for ClassExistenceResource when relevant · symfony/symfony@222b56d · GitHub
[go: up one dir, main page]

Skip to content

Commit 222b56d

Browse files
committed
[TwigBundle] added support for ClassExistenceResource when relevant
1 parent d98eb7b commit 222b56d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111

1212
namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\Config\Resource\ClassExistenceResource;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Reference;
18+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
19+
use Symfony\Component\Stopwatch\Stopwatch;
20+
use Symfony\Component\Yaml\Parser as YamlParser;
1721

1822
/**
1923
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
@@ -72,15 +76,18 @@ public function process(ContainerBuilder $container)
7276
$container->getDefinition('twig.extension.assets')->addTag('twig.extension');
7377
}
7478

75-
if (class_exists('Symfony\Component\Yaml\Parser')) {
79+
$container->addResource(new ClassExistenceResource(YamlParser::class));
80+
if (class_exists(YamlParser::class)) {
7681
$container->getDefinition('twig.extension.yaml')->addTag('twig.extension');
7782
}
7883

79-
if (class_exists('Symfony\Component\Stopwatch\Stopwatch')) {
84+
$container->addResource(new ClassExistenceResource(Stopwatch::class));
85+
if (class_exists(Stopwatch::class)) {
8086
$container->getDefinition('twig.extension.debug.stopwatch')->addTag('twig.extension');
8187
}
8288

83-
if (class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
89+
$container->addResource(new ClassExistenceResource(ExpressionLanguage::class));
90+
if (class_exists(ExpressionLanguage::class)) {
8491
$container->getDefinition('twig.extension.expression')->addTag('twig.extension');
8592
}
8693
}

src/Symfony/Bundle/TwigBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"symfony/stopwatch": "~2.8|~3.0",
2828
"symfony/dependency-injection": "~2.8|~3.0",
2929
"symfony/expression-language": "~2.8|~3.0",
30-
"symfony/config": "~2.8|~3.0",
30+
"symfony/config": "~3.2",
3131
"symfony/finder": "~2.8|~3.0",
3232
"symfony/routing": "~2.8|~3.0",
3333
"symfony/templating": "~2.8|~3.0",

src/Symfony/Component/Config/Resource/ClassExistenceResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Config\Resource;
1313

1414
/**
15-
* ClassExistenceResource represents a class availability.
16-
* Freshness is only evaluated against resource availability.
15+
* ClassExistenceResource represents a class existence.
16+
* Freshness is only evaluated against resource existence.
1717
*
1818
* The resource must be a fully-qualified class name.
1919
*

0 commit comments

Comments
 (0)
0