From b8dabf67341a0d1d5262b2dfcd99841f15f5eccc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 13 Dec 2016 13:08:53 +0100 Subject: [PATCH] Cleanups --- lib/Twig/Error.php | 11 ----------- lib/Twig/ExpressionParser.php | 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index d10b55555..2417b5686 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -36,7 +36,6 @@ class Twig_Error extends Exception private $lineno; private $name; private $rawMessage; - private $sourcePath; private $sourceCode; @@ -94,16 +93,6 @@ class Twig_Error extends Exception return $this->rawMessage; } - /** - * Gets the logical name where the error occurred. - * - * @return string The name - */ - public function getTemplateName() - { - return $this->name; - } - /** * Gets the template line where the error occurred. * diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index 04ac829f1..56fcbafc1 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -634,7 +634,7 @@ class Twig_ExpressionParser $message .= sprintf('. Use "%s" instead', $test->getAlternative()); } $src = $stream->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine()); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine()); @trigger_error($message, E_USER_DEPRECATED); } @@ -660,7 +660,7 @@ class Twig_ExpressionParser $message .= sprintf('. Use "%s" instead', $function->getAlternative()); } $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); @trigger_error($message, E_USER_DEPRECATED); } @@ -686,7 +686,7 @@ class Twig_ExpressionParser $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); } $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); @trigger_error($message, E_USER_DEPRECATED); }