Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff3649b

Browse filesBrowse files
committed
minor #30952 [TwigBundle][TwigBridge] Improving deprecation message of the legacy Twig template directory (yceruto)
This PR was merged into the 4.2 branch. Discussion ---------- [TwigBundle][TwigBridge] Improving deprecation message of the legacy Twig template directory | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #30088 | License | MIT #eu-fossa Commits ------- 89a00b3 Improving deprecation message of the Twig templates directory src/Resources/views
2 parents 07a1095 + 89a00b3 commit ff3649b
Copy full SHA for ff3649b

File tree

5 files changed

+10
-10
lines changed
Filter options

5 files changed

+10
-10
lines changed

‎src/Symfony/Bridge/Twig/Command/DebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Command/DebugCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private function findWrongBundleOverrides(): array
379379
$path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR);
380380
$carry[$name] = $path;
381381

382-
@trigger_error(sprintf('Templates directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $absolutePath, $this->twigDefaultPath.'/bundles/'.$name), E_USER_DEPRECATED);
382+
@trigger_error(sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, use "%s" instead.', $absolutePath, $this->twigDefaultPath.'/bundles/'.$name), E_USER_DEPRECATED);
383383
}
384384

385385
return $carry;

‎src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testWarningsWrongBundleOverriding()
6565

6666
/**
6767
* @group legacy
68-
* @expectedDeprecation Templates directory "%sResources/BarBundle/views" is deprecated since Symfony 4.2, use "%stemplates/bundles/BarBundle" instead.
68+
* @expectedDeprecation Loading Twig templates from the "%sResources/BarBundle/views" directory is deprecated since Symfony 4.2, use "%stemplates/bundles/BarBundle" instead.
6969
*/
7070
public function testDeprecationForWrongBundleOverridingInLegacyPath()
7171
{

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
145145
$viewsPaths = [];
146146
if (is_dir($dir = $rootDir.'/Resources/views')) {
147147
if ($dir !== $this->defaultViewsPath) {
148-
$notice = sprintf('Storing templates in the "%s" directory is deprecated since Symfony 4.2, ', $dir);
148+
$notice = sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, ', $dir);
149149
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
150150
}
151151
$viewsPaths[] = $dir;
@@ -173,7 +173,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
173173
}
174174
if (is_dir($dir = sprintf('%s/Resources/%s/views', $rootDir, $bundle->getName()))) {
175175
$viewsPaths[] = $dir;
176-
$notice = sprintf('Storing templates for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $dir);
176+
$notice = sprintf('Loading Twig templates for "%s" from the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $dir);
177177
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
178178
}
179179
} catch (\InvalidArgumentException $e) {
@@ -191,7 +191,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
191191
$viewsPaths = [$path.'/templates'];
192192
if (is_dir($dir = $path.'/Resources/views')) {
193193
if ($dir !== $this->defaultViewsPath) {
194-
@trigger_error(sprintf('Storing templates in the "%s" directory is deprecated since Symfony 4.2, use the "%s" directory instead.', $dir, $path.'/templates'), E_USER_DEPRECATED);
194+
@trigger_error(sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, use the "%s" directory instead.', $dir, $path.'/templates'), E_USER_DEPRECATED);
195195
}
196196
$viewsPaths[] = $dir;
197197
}
@@ -211,7 +211,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
211211
$viewsPaths[] = $bundle->getPath().'/Resources/views';
212212
if (is_dir($deprecatedPath = sprintf('%s/Resources/%s/views', $rootDir, $bundle->getName()))) {
213213
$viewsPaths[] = $deprecatedPath;
214-
$notice = sprintf('Storing templates for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $deprecatedPath);
214+
$notice = sprintf('Loading Twig templates for "%s" from the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $deprecatedPath);
215215
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
216216
}
217217
}

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function load(array $configs, ContainerBuilder $container)
117117

118118
if (file_exists($dir = $container->getParameter('kernel.root_dir').'/Resources/views')) {
119119
if ($dir !== $defaultTwigPath) {
120-
@trigger_error(sprintf('Templates directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultTwigPath), E_USER_DEPRECATED);
120+
@trigger_error(sprintf('Loading Twig templates from the "%s" directory is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultTwigPath), E_USER_DEPRECATED);
121121
}
122122

123123
$twigFilesystemLoaderDefinition->addMethodCall('addPath', [$dir]);
@@ -172,7 +172,7 @@ private function getBundleTemplatePaths(ContainerBuilder $container, array $conf
172172
$defaultOverrideBundlePath = $container->getParameterBag()->resolveValue($config['default_path']).'/bundles/'.$name;
173173

174174
if (file_exists($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$name.'/views')) {
175-
@trigger_error(sprintf('Templates directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultOverrideBundlePath), E_USER_DEPRECATED);
175+
@trigger_error(sprintf('Loading Twig templates for "%s" from the "%s" directory is deprecated since Symfony 4.2, use "%s" instead.', $name, $dir, $defaultOverrideBundlePath), E_USER_DEPRECATED);
176176

177177
$bundleHierarchy[$name][] = $dir;
178178
}

‎src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ public function testTwigLoaderPaths($format)
203203
/**
204204
* @group legacy
205205
* @dataProvider getFormats
206-
* @expectedDeprecation Templates directory "%s/Resources/TwigBundle/views" is deprecated since Symfony 4.2, use "%s/templates/bundles/TwigBundle" instead.
207-
* @expectedDeprecation Templates directory "%s/Resources/views" is deprecated since Symfony 4.2, use "%s/templates" instead.
206+
* @expectedDeprecation Loading Twig templates for "TwigBundle" from the "%s/Resources/TwigBundle/views" directory is deprecated since Symfony 4.2, use "%s/templates/bundles/TwigBundle" instead.
207+
* @expectedDeprecation Loading Twig templates from the "%s/Resources/views" directory is deprecated since Symfony 4.2, use "%s/templates" instead.
208208
*/
209209
public function testLegacyTwigLoaderPaths($format)
210210
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.