Upgrade framework
This commit is contained in:
@@ -12,22 +12,13 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* AccessDeniedHttpException.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class AccessDeniedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(403, $message, $previous, array(), $code);
|
||||
parent::__construct(403, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* BadRequestHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class BadRequestHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(400, $message, $previous, array(), $code);
|
||||
parent::__construct(400, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* ConflictHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class ConflictHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(409, $message, $previous, array(), $code);
|
||||
parent::__construct(409, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
84
vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php
vendored
Normal file
84
vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class ControllerDoesNotReturnResponseException extends \LogicException
|
||||
{
|
||||
public function __construct(string $message, callable $controller, string $file, int $line)
|
||||
{
|
||||
parent::__construct($message);
|
||||
|
||||
if (!$controllerDefinition = $this->parseControllerDefinition($controller)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->file = $controllerDefinition['file'];
|
||||
$this->line = $controllerDefinition['line'];
|
||||
$r = new \ReflectionProperty(\Exception::class, 'trace');
|
||||
$r->setAccessible(true);
|
||||
$r->setValue($this, array_merge([
|
||||
[
|
||||
'line' => $line,
|
||||
'file' => $file,
|
||||
],
|
||||
], $this->getTrace()));
|
||||
}
|
||||
|
||||
private function parseControllerDefinition(callable $controller): ?array
|
||||
{
|
||||
if (\is_string($controller) && str_contains($controller, '::')) {
|
||||
$controller = explode('::', $controller);
|
||||
}
|
||||
|
||||
if (\is_array($controller)) {
|
||||
try {
|
||||
$r = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
|
||||
return [
|
||||
'file' => $r->getFileName(),
|
||||
'line' => $r->getEndLine(),
|
||||
];
|
||||
} catch (\ReflectionException $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($controller instanceof \Closure) {
|
||||
$r = new \ReflectionFunction($controller);
|
||||
|
||||
return [
|
||||
'file' => $r->getFileName(),
|
||||
'line' => $r->getEndLine(),
|
||||
];
|
||||
}
|
||||
|
||||
if (\is_object($controller)) {
|
||||
$r = new \ReflectionClass($controller);
|
||||
|
||||
try {
|
||||
$line = $r->getMethod('__invoke')->getEndLine();
|
||||
} catch (\ReflectionException $e) {
|
||||
$line = $r->getEndLine();
|
||||
}
|
||||
|
||||
return [
|
||||
'file' => $r->getFileName(),
|
||||
'line' => $line,
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* GoneHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class GoneHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(410, $message, $previous, array(), $code);
|
||||
parent::__construct(410, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class HttpException extends \RuntimeException implements HttpExceptionInterface
|
||||
{
|
||||
private $statusCode;
|
||||
private $headers;
|
||||
private int $statusCode;
|
||||
private array $headers;
|
||||
|
||||
public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0)
|
||||
public function __construct(int $statusCode, string $message = '', \Throwable $previous = null, array $headers = [], int $code = 0)
|
||||
{
|
||||
$this->statusCode = $statusCode;
|
||||
$this->headers = $headers;
|
||||
@@ -29,21 +29,16 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
public function getStatusCode()
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set response headers.
|
||||
*
|
||||
* @param array $headers Response headers
|
||||
*/
|
||||
public function setHeaders(array $headers)
|
||||
{
|
||||
$this->headers = $headers;
|
||||
|
||||
@@ -16,19 +16,15 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
interface HttpExceptionInterface
|
||||
interface HttpExceptionInterface extends \Throwable
|
||||
{
|
||||
/**
|
||||
* Returns the status code.
|
||||
*
|
||||
* @return int An HTTP response status code
|
||||
*/
|
||||
public function getStatusCode();
|
||||
public function getStatusCode(): int;
|
||||
|
||||
/**
|
||||
* Returns response headers.
|
||||
*
|
||||
* @return array Response headers
|
||||
*/
|
||||
public function getHeaders();
|
||||
public function getHeaders(): array;
|
||||
}
|
||||
|
||||
16
vendor/symfony/http-kernel/Exception/InvalidMetadataException.php
vendored
Normal file
16
vendor/symfony/http-kernel/Exception/InvalidMetadataException.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
class InvalidMetadataException extends \LogicException
|
||||
{
|
||||
}
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* LengthRequiredHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class LengthRequiredHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(411, $message, $previous, array(), $code);
|
||||
parent::__construct(411, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,23 +12,16 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* MethodNotAllowedHttpException.
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
class MethodNotAllowedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $allow An array of allowed methods
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
* @param string[] $allow An array of allowed methods
|
||||
*/
|
||||
public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(array $allow, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
$headers = array('Allow' => strtoupper(implode(', ', $allow)));
|
||||
$headers['Allow'] = strtoupper(implode(', ', $allow));
|
||||
|
||||
parent::__construct(405, $message, $previous, $headers, $code);
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* NotAcceptableHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class NotAcceptableHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(406, $message, $previous, array(), $code);
|
||||
parent::__construct(406, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* NotFoundHttpException.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class NotFoundHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(404, $message, $previous, array(), $code);
|
||||
parent::__construct(404, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* PreconditionFailedHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class PreconditionFailedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(412, $message, $previous, array(), $code);
|
||||
parent::__construct(412, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,23 +12,14 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* PreconditionRequiredHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc6585
|
||||
*/
|
||||
class PreconditionRequiredHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(428, $message, $previous, array(), $code);
|
||||
parent::__construct(428, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,25 +12,17 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* ServiceUnavailableHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class ServiceUnavailableHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
* @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
*/
|
||||
public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
$headers = array();
|
||||
if ($retryAfter) {
|
||||
$headers = array('Retry-After' => $retryAfter);
|
||||
$headers['Retry-After'] = $retryAfter;
|
||||
}
|
||||
|
||||
parent::__construct(503, $message, $previous, $headers, $code);
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* TooManyRequestsHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc6585
|
||||
@@ -21,18 +19,12 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
class TooManyRequestsHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
* @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
*/
|
||||
public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
$headers = array();
|
||||
if ($retryAfter) {
|
||||
$headers = array('Retry-After' => $retryAfter);
|
||||
$headers['Retry-After'] = $retryAfter;
|
||||
}
|
||||
|
||||
parent::__construct(429, $message, $previous, $headers, $code);
|
||||
|
||||
@@ -12,23 +12,16 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* UnauthorizedHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class UnauthorizedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $challenge WWW-Authenticate challenge string
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
* @param string $challenge WWW-Authenticate challenge string
|
||||
*/
|
||||
public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $challenge, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
$headers = array('WWW-Authenticate' => $challenge);
|
||||
$headers['WWW-Authenticate'] = $challenge;
|
||||
|
||||
parent::__construct(401, $message, $previous, $headers, $code);
|
||||
}
|
||||
|
||||
19
vendor/symfony/http-kernel/Exception/UnexpectedSessionUsageException.php
vendored
Normal file
19
vendor/symfony/http-kernel/Exception/UnexpectedSessionUsageException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
class UnexpectedSessionUsageException extends \LogicException
|
||||
{
|
||||
}
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* UnprocessableEntityHttpException.
|
||||
*
|
||||
* @author Steve Hutchins <hutchinsteve@gmail.com>
|
||||
*/
|
||||
class UnprocessableEntityHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(422, $message, $previous, array(), $code);
|
||||
parent::__construct(422, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,12 @@
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* UnsupportedMediaTypeHttpException.
|
||||
*
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class UnsupportedMediaTypeHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(415, $message, $previous, array(), $code);
|
||||
parent::__construct(415, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user