1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
Daniel Neto 2024-03-05 19:22:51 -03:00
parent 7673eda07e
commit 330cdbe615
9054 changed files with 480487 additions and 41800 deletions

View file

@ -25,14 +25,8 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
/**
* @param string[] $allowedMethods
*/
public function __construct(array $allowedMethods, ?string $message = '', int $code = 0, \Throwable $previous = null)
public function __construct(array $allowedMethods, string $message = '', int $code = 0, ?\Throwable $previous = null)
{
if (null === $message) {
trigger_deprecation('symfony/routing', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__);
$message = '';
}
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
parent::__construct($message, $code, $previous);
@ -43,7 +37,7 @@ class MethodNotAllowedException extends \RuntimeException implements ExceptionIn
*
* @return string[]
*/
public function getAllowedMethods()
public function getAllowedMethods(): array
{
return $this->allowedMethods;
}

View file

@ -19,4 +19,39 @@ namespace Symfony\Component\Routing\Exception;
*/
class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface
{
private string $routeName = '';
private array $missingParameters = [];
/**
* @param string[] $missingParameters
* @param int $code
*/
public function __construct(string $routeName = '', $missingParameters = null, $code = 0, ?\Throwable $previous = null)
{
if (\is_array($missingParameters)) {
$this->routeName = $routeName;
$this->missingParameters = $missingParameters;
$message = sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', $missingParameters), $routeName);
} else {
trigger_deprecation('symfony/routing', '6.1', 'Construction of "%s" with an exception message is deprecated, provide the route name and an array of missing parameters instead.', __CLASS__);
$message = $routeName;
$previous = $code instanceof \Throwable ? $code : null;
$code = (int) $missingParameters;
}
parent::__construct($message, $code, $previous);
}
/**
* @return string[]
*/
public function getMissingParameters(): array
{
return $this->missingParameters;
}
public function getRouteName(): string
{
return $this->routeName;
}
}