Merge branch '1.x' into 2.x

* 1.x:
  Cleanup
This commit is contained in:
Fabien Potencier
2016-12-13 15:08:37 +01:00
2 changed files with 8 additions and 21 deletions
+7 -10
View File
@@ -24,18 +24,15 @@
*/
class Twig_Error_Loader extends Twig_Error
{
private $guess = false;
public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
{
parent::__construct($message, false, null, $previous);
$this->guess = true;
}
protected function guessTemplateInfo()
{
if ($this->guess) {
parent::guessTemplateInfo();
if (PHP_VERSION_ID < 50300) {
$this->previous = $previous;
Exception::__construct('');
} else {
Exception::__construct('', 0, $previous);
}
$this->appendMessage($message);
$this->setTemplateLine(false);
}
}
+1 -11
View File
@@ -170,12 +170,6 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
return;
}
if ($e instanceof Twig_Error_Syntax) {
$e->setTemplateName($file);
throw $e;
}
throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
}
@@ -188,11 +182,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
return;
}
if ($e instanceof Twig_Error_Syntax) {
$e->setTemplateName($file);
} else {
$e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
}
$e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
$output = trim(sprintf('%s: %s', get_class($e), $e->getMessage()));
}