deprecated passing a 4th and 5th arguments to the Sandbox exception classes

This commit is contained in:
Fabien Potencier
2019-04-16 18:11:16 +02:00
parent d15d794edf
commit 5312086b2d
6 changed files with 41 additions and 0 deletions
@@ -15,6 +15,8 @@ namespace Twig\Sandbox;
* Exception thrown when a not allowed function is used in a template.
*
* @author Martin Hasoň <martin.hason@gmail.com>
*
* @final
*/
class SecurityNotAllowedFunctionError extends SecurityError
{
@@ -22,6 +24,12 @@ class SecurityNotAllowedFunctionError extends SecurityError
public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null)
{
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;
}