Selaa lähdekoodia

removed some json_encode() calls to use the new getLogicalName() method instead

Fabien Potencier 14 vuotta sitten
vanhempi
commit
a230090537

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php

@@ -60,7 +60,7 @@ class TemplateLocator implements FileLocatorInterface
         try {
             return $this->cache[$key] = $this->locator->locate($template->getPath(), $this->path);
         } catch (\InvalidArgumentException $e) {
-            throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', $template->getPath(), $this->path), 0, $e);
+            throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', $template->getLogicalName(), $this->path), 0, $e);
         }
     }
 }

+ 1 - 1
src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php

@@ -94,7 +94,7 @@ class FilesystemLoader implements \Twig_LoaderInterface
         }
 
         if (false === $file || null === $file) {
-            throw new \Twig_Error_Loader(sprintf('Unable to find the template %s', json_encode($name)), -1, null, $previous);
+            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $tpl->getLogicalName()), -1, null, $previous);
         }
 
         return $this->cache[$key] = $file;

+ 1 - 1
src/Symfony/Component/Templating/DelegatingEngine.php

@@ -106,6 +106,6 @@ class DelegatingEngine implements EngineInterface
             }
         }
 
-        throw new \RuntimeException(sprintf('No engine is able to work with the "%s" template.', $name));
+        throw new \RuntimeException(sprintf('No engine is able to work with the %s template.', json_encode($name)));
     }
 }

+ 1 - 1
src/Symfony/Component/Templating/PhpEngine.php

@@ -82,7 +82,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
         $parameters = array_replace($this->getGlobals(), $parameters);
         // render
         if (false === $content = $this->evaluate($storage, $parameters)) {
-            throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', json_encode($name)));
+            throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', $this->parser->parse($name)->getLogicalName()));
         }
 
         // decorator