mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 15:07:11 +00:00
removed obsolete Error features
This commit is contained in:
+6
-9
@@ -56,20 +56,17 @@ class Error extends \Exception
|
|||||||
*
|
*
|
||||||
* By default, automatic guessing is enabled.
|
* By default, automatic guessing is enabled.
|
||||||
*
|
*
|
||||||
* @param string $message The error message
|
* @param string $message The error message
|
||||||
* @param int $lineno The template line where the error occurred
|
* @param int $lineno The template line where the error occurred
|
||||||
* @param Source|string|null $source The source context where the error occurred
|
* @param Source|null $source The source context where the error occurred
|
||||||
* @param \Exception $previous The previous exception
|
* @param \Exception $previous The previous exception
|
||||||
*/
|
*/
|
||||||
public function __construct(string $message, int $lineno = -1, $source = null, \Exception $previous = null)
|
public function __construct(string $message, int $lineno = -1, Source $source = null, \Exception $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct('', 0, $previous);
|
parent::__construct('', 0, $previous);
|
||||||
|
|
||||||
if (null === $source) {
|
if (null === $source) {
|
||||||
$name = null;
|
$name = null;
|
||||||
} elseif (!$source instanceof Source && !$source instanceof \Twig_Source) {
|
|
||||||
@trigger_error(sprintf('Passing a string as a source to %s is deprecated since Twig 2.6.1; pass a Twig\Source instance instead.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
$name = $source;
|
|
||||||
} else {
|
} else {
|
||||||
$name = $source->getName();
|
$name = $source->getName();
|
||||||
$this->sourceCode = $source->getCode();
|
$this->sourceCode = $source->getCode();
|
||||||
@@ -204,7 +201,7 @@ class Error extends \Exception
|
|||||||
|
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||||
foreach ($backtrace as $trace) {
|
foreach ($backtrace as $trace) {
|
||||||
if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) {
|
if (isset($trace['object']) && $trace['object'] instanceof Template) {
|
||||||
$currentClass = \get_class($trace['object']);
|
$currentClass = \get_class($trace['object']);
|
||||||
$isEmbedContainer = 0 === strpos($templateClass, $currentClass);
|
$isEmbedContainer = 0 === strpos($templateClass, $currentClass);
|
||||||
if (null === $this->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
|
if (null === $this->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
|
||||||
|
|||||||
@@ -22,18 +22,9 @@ class SecurityNotAllowedFilterError extends SecurityError
|
|||||||
{
|
{
|
||||||
private $filterName;
|
private $filterName;
|
||||||
|
|
||||||
public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null)
|
public function __construct(string $message, string $functionName)
|
||||||
{
|
{
|
||||||
if (-1 !== $lineno) {
|
parent::__construct($message);
|
||||||
@trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $filename) {
|
|
||||||
@trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $previous) {
|
|
||||||
@trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
parent::__construct($message, $lineno, $filename, $previous);
|
|
||||||
$this->filterName = $functionName;
|
$this->filterName = $functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,18 +22,9 @@ class SecurityNotAllowedFunctionError extends SecurityError
|
|||||||
{
|
{
|
||||||
private $functionName;
|
private $functionName;
|
||||||
|
|
||||||
public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null)
|
public function __construct(string $message, string $functionName)
|
||||||
{
|
{
|
||||||
if (-1 !== $lineno) {
|
parent::__construct($message);
|
||||||
@trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $filename) {
|
|
||||||
@trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $previous) {
|
|
||||||
@trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
parent::__construct($message, $lineno, $filename, $previous);
|
|
||||||
$this->functionName = $functionName;
|
$this->functionName = $functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,9 @@ class SecurityNotAllowedMethodError extends SecurityError
|
|||||||
private $className;
|
private $className;
|
||||||
private $methodName;
|
private $methodName;
|
||||||
|
|
||||||
public function __construct(string $message, string $className, string $methodName, int $lineno = -1, string $filename = null, \Exception $previous = null)
|
public function __construct(string $message, string $className, string $methodName)
|
||||||
{
|
{
|
||||||
if (-1 !== $lineno) {
|
parent::__construct($message);
|
||||||
@trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $filename) {
|
|
||||||
@trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $previous) {
|
|
||||||
@trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
parent::__construct($message, $lineno, $filename, $previous);
|
|
||||||
$this->className = $className;
|
$this->className = $className;
|
||||||
$this->methodName = $methodName;
|
$this->methodName = $methodName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,18 +23,9 @@ class SecurityNotAllowedPropertyError extends SecurityError
|
|||||||
private $className;
|
private $className;
|
||||||
private $propertyName;
|
private $propertyName;
|
||||||
|
|
||||||
public function __construct(string $message, string $className, string $propertyName, int $lineno = -1, string $filename = null, \Exception $previous = null)
|
public function __construct(string $message, string $className, string $propertyName)
|
||||||
{
|
{
|
||||||
if (-1 !== $lineno) {
|
parent::__construct($message);
|
||||||
@trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $filename) {
|
|
||||||
@trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $previous) {
|
|
||||||
@trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
parent::__construct($message, $lineno, $filename, $previous);
|
|
||||||
$this->className = $className;
|
$this->className = $className;
|
||||||
$this->propertyName = $propertyName;
|
$this->propertyName = $propertyName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,18 +22,9 @@ class SecurityNotAllowedTagError extends SecurityError
|
|||||||
{
|
{
|
||||||
private $tagName;
|
private $tagName;
|
||||||
|
|
||||||
public function __construct(string $message, string $tagName, int $lineno = -1, string $filename = null, \Exception $previous = null)
|
public function __construct(string $message, string $tagName)
|
||||||
{
|
{
|
||||||
if (-1 !== $lineno) {
|
parent::__construct($message);
|
||||||
@trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $filename) {
|
|
||||||
@trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
if (null !== $previous) {
|
|
||||||
@trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
parent::__construct($message, $lineno, $filename, $previous);
|
|
||||||
$this->tagName = $tagName;
|
$this->tagName = $tagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user