Skip to content

Commit f5b0da6

Browse files
dunglasteohhanhui
authored andcommitted
Fix TwigBundle config
1 parent 7a72246 commit f5b0da6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ parameters:
2525
path: %currentWorkingDirectory%/src/Identifier/Normalizer/IntegerDenormalizer.php
2626

2727
# False positives
28+
- '#Class Symfony\\Component\\ErrorRenderer\\ErrorRenderer not found\.#'
2829
-
2930
message: '#Variable \$positionPm might not be defined\.#'
3031
path: %currentWorkingDirectory%/src/Util/ClassInfoTrait.php

tests/Fixtures/app/AppKernel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
2828
use Symfony\Component\Config\Loader\LoaderInterface;
2929
use Symfony\Component\DependencyInjection\ContainerBuilder;
30+
use Symfony\Component\ErrorRenderer\ErrorRenderer;
3031
use Symfony\Component\HttpKernel\Kernel;
3132
use Symfony\Component\Routing\RouteCollectionBuilder;
3233
use Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder;
@@ -152,6 +153,12 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
152153
]);
153154
}
154155

156+
$twigConfig = ['strict_variables' => '%kernel.debug%'];
157+
if (class_exists(ErrorRenderer::class)) {
158+
$twigConfig['exception_controller'] = null;
159+
}
160+
$c->prependExtensionConfig('twig', $twigConfig);
161+
155162
if ($_SERVER['LEGACY'] ?? true) {
156163
$c->prependExtensionConfig('nelmio_api_doc', [
157164
'sandbox' => [

tests/Fixtures/app/config/config_common.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ doctrine:
2828
auto_generate_proxy_classes: '%kernel.debug%'
2929
auto_mapping: true
3030

31-
twig:
32-
strict_variables: '%kernel.debug%'
33-
exception_controller: null
34-
3531
mercure:
3632
hubs:
3733
default:

0 commit comments

Comments
 (0)