updated composer

This commit is contained in:
2021-05-18 13:47:03 +00:00
parent e248cd036c
commit ba92152daa
1187 changed files with 20804 additions and 22320 deletions

View File

@@ -36,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
{
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
}

View File

@@ -42,15 +42,22 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
$this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'symfony_version' => Kernel::VERSION,
'symfony_state' => 'unknown',
'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
'symfony_lts' => 4 === Kernel::MINOR_VERSION,
'symfony_state' => $this->determineSymfonyState(),
'symfony_eom' => $eom->format('F Y'),
'symfony_eol' => $eol->format('F Y'),
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
'php_version' => \PHP_VERSION,
'php_architecture' => \PHP_INT_SIZE * 8,
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
'php_timezone' => date_default_timezone_get(),
'xdebug_enabled' => \extension_loaded('xdebug'),
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
@@ -63,14 +70,6 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
foreach ($this->kernel->getBundles() as $name => $bundle) {
$this->data['bundles'][$name] = new ClassStub(\get_class($bundle));
}
$this->data['symfony_state'] = $this->determineSymfonyState();
$this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION);
$this->data['symfony_lts'] = 4 === Kernel::MINOR_VERSION;
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
$this->data['symfony_eom'] = $eom->format('F Y');
$this->data['symfony_eol'] = $eol->format('F Y');
}
if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
@@ -180,7 +179,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function getPhpVersionExtra()
{
return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
return $this->data['php_version_extra'] ?? null;
}
/**
@@ -220,7 +219,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
/**
* Returns true if the debug is enabled.
*
* @return bool true if debug is enabled, false otherwise
* @return bool|string true if debug is enabled, false otherwise or a string if no kernel was set
*/
public function isDebug()
{

View File

@@ -178,8 +178,13 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$charset = array_pop($this->data);
$fileLinkFormat = array_pop($this->data);
$this->dataCount = \count($this->data);
foreach ($this->data as $dump) {
if (!\is_string($dump['name']) || !\is_string($dump['file']) || !\is_int($dump['line'])) {
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
}
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
self::__construct($this->stopwatch, \is_string($fileLinkFormat) || $fileLinkFormat instanceof FileLinkFormatter ? $fileLinkFormat : null, \is_string($charset) ? $charset : null);
}
public function getDumpsCount(): int
@@ -189,7 +194,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1): array
{
$data = fopen('php://memory', 'r+b');
$data = fopen('php://memory', 'r+');
if ('html' === $format) {
$dumper = new HtmlDumper($data, $this->charset);
@@ -252,7 +257,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
}
}
private function doDump(DataDumperInterface $dumper, $data, string $name, string $file, int $line)
private function doDump(DataDumperInterface $dumper, Data $data, string $name, string $file, int $line)
{
if ($dumper instanceof CliDumper) {
$contextDumper = function ($name, $file, $line, $fmt) {

View File

@@ -79,32 +79,32 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
public function getLogs()
{
return isset($this->data['logs']) ? $this->data['logs'] : [];
return $this->data['logs'] ?? [];
}
public function getPriorities()
{
return isset($this->data['priorities']) ? $this->data['priorities'] : [];
return $this->data['priorities'] ?? [];
}
public function countErrors()
{
return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
return $this->data['error_count'] ?? 0;
}
public function countDeprecations()
{
return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;
return $this->data['deprecation_count'] ?? 0;
}
public function countWarnings()
{
return isset($this->data['warning_count']) ? $this->data['warning_count'] : 0;
return $this->data['warning_count'] ?? 0;
}
public function countScreams()
{
return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0;
return $this->data['scream_count'] ?? 0;
}
public function getCompilerLogs()

View File

@@ -91,7 +91,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
'content_type' => $response->headers->get('Content-Type', 'text/html'),
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
'status_text' => Response::$statusTexts[$statusCode] ?? '',
'status_code' => $statusCode,
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
@@ -359,12 +359,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
*/
public function getRedirect()
{
return isset($this->data['redirect']) ? $this->data['redirect'] : false;
return $this->data['redirect'] ?? false;
}
public function getForwardToken()
{
return isset($this->data['forward_token']) ? $this->data['forward_token'] : null;
return $this->data['forward_token'] ?? null;
}
public function onKernelController(ControllerEvent $event)

View File

@@ -56,14 +56,13 @@ abstract class AbstractSessionListener implements EventSubscriberInterface
return;
}
$session = null;
$request = $event->getRequest();
if (!$request->hasSession()) {
$sess = null;
$request->setSessionFactory(function () use (&$sess) { return $sess ?? $sess = $this->getSession(); });
}
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);
$session = $this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null;
$this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : 0;
}

View File

@@ -30,6 +30,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
*/
class DebugHandlersListener implements EventSubscriberInterface
{
private $earlyHandler;
private $exceptionHandler;
private $logger;
private $deprecationLogger;
@@ -51,6 +52,10 @@ class DebugHandlersListener implements EventSubscriberInterface
*/
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
{
$handler = set_exception_handler('var_dump');
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();
$this->exceptionHandler = $exceptionHandler;
$this->logger = $logger;
$this->levels = null === $levels ? \E_ALL : $levels;
@@ -78,6 +83,10 @@ class DebugHandlersListener implements EventSubscriberInterface
$handler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();
if (!$handler instanceof ErrorHandler) {
$handler = $this->earlyHandler;
}
if ($handler instanceof ErrorHandler) {
if ($this->logger || $this->deprecationLogger) {
$this->setDefaultLoggers($handler);

View File

@@ -116,7 +116,7 @@ class RouterListener implements EventSubscriberInterface
if (null !== $this->logger) {
$this->logger->info('Matched route "{route}".', [
'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a',
'route' => $parameters['_route'] ?? 'n/a',
'route_parameters' => $parameters,
'request_uri' => $request->getUri(),
'method' => $request->getMethod(),

View File

@@ -14,6 +14,7 @@ namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Symfony\Component\HttpKernel\Event\RequestEvent;
/**
* Sets the session in the request.
@@ -33,10 +34,12 @@ class SessionListener extends AbstractSessionListener
parent::__construct($container, $debug);
}
protected function getSession(): ?SessionInterface
public function onKernelRequest(RequestEvent $event)
{
if (!$this->container->has('session')) {
return null;
parent::onKernelRequest($event);
if (!$event->isMasterRequest() || !$this->container->has('session')) {
return;
}
if ($this->container->has('session_storage')
@@ -46,6 +49,13 @@ class SessionListener extends AbstractSessionListener
) {
$storage->setOptions(['cookie_secure' => true]);
}
}
protected function getSession(): ?SessionInterface
{
if (!$this->container->has('session')) {
return null;
}
return $this->container->get('session');
}

View File

@@ -18,11 +18,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class AccessDeniedHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(403, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class BadRequestHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(400, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class ConflictHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(409, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class GoneHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(410, $message, $previous, $headers, $code);
}

View File

@@ -21,7 +21,7 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface
private $statusCode;
private $headers;
public function __construct(int $statusCode, string $message = null, \Throwable $previous = null, array $headers = [], ?int $code = 0)
public function __construct(int $statusCode, ?string $message = '', \Throwable $previous = null, array $headers = [], ?int $code = 0)
{
$this->statusCode = $statusCode;
$this->headers = $headers;

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class LengthRequiredHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(411, $message, $previous, $headers, $code);
}

View File

@@ -17,12 +17,12 @@ namespace Symfony\Component\HttpKernel\Exception;
class MethodNotAllowedHttpException extends HttpException
{
/**
* @param array $allow An array of allowed methods
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string[] $allow An array of allowed methods
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int|null $code The internal exception code
*/
public function __construct(array $allow, string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
public function __construct(array $allow, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = [])
{
$headers['Allow'] = strtoupper(implode(', ', $allow));

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class NotAcceptableHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(406, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class NotFoundHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(404, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class PreconditionFailedHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(412, $message, $previous, $headers, $code);
}

View File

@@ -19,11 +19,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class PreconditionRequiredHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(428, $message, $previous, $headers, $code);
}

View File

@@ -17,12 +17,12 @@ namespace Symfony\Component\HttpKernel\Exception;
class ServiceUnavailableHttpException extends HttpException
{
/**
* @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 \Throwable $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
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int|null $code The internal exception code
*/
public function __construct($retryAfter = null, string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
public function __construct($retryAfter = null, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = [])
{
if ($retryAfter) {
$headers['Retry-After'] = $retryAfter;

View File

@@ -19,12 +19,12 @@ namespace Symfony\Component\HttpKernel\Exception;
class TooManyRequestsHttpException extends HttpException
{
/**
* @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 \Throwable $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
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int|null $code The internal exception code
*/
public function __construct($retryAfter = null, string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
public function __construct($retryAfter = null, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = [])
{
if ($retryAfter) {
$headers['Retry-After'] = $retryAfter;

View File

@@ -17,12 +17,12 @@ namespace Symfony\Component\HttpKernel\Exception;
class UnauthorizedHttpException extends HttpException
{
/**
* @param string $challenge WWW-Authenticate challenge string
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string $challenge WWW-Authenticate challenge string
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int|null $code The internal exception code
*/
public function __construct(string $challenge, string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = [])
public function __construct(string $challenge, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = [])
{
$headers['WWW-Authenticate'] = $challenge;

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class UnprocessableEntityHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(422, $message, $previous, $headers, $code);
}

View File

@@ -17,11 +17,11 @@ namespace Symfony\Component\HttpKernel\Exception;
class UnsupportedMediaTypeHttpException extends HttpException
{
/**
* @param string $message The internal exception message
* @param \Throwable $previous The previous exception
* @param int $code The internal exception code
* @param string|null $message The internal exception message
* @param \Throwable|null $previous The previous exception
* @param int $code The internal exception code
*/
public function __construct(string $message = null, \Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(415, $message, $previous, $headers, $code);
}

View File

@@ -71,12 +71,12 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
$uri = $this->generateSignedFragmentUri($uri, $request);
}
$alt = isset($options['alt']) ? $options['alt'] : null;
$alt = $options['alt'] ?? null;
if ($alt instanceof ControllerReference) {
$alt = $this->generateSignedFragmentUri($alt, $request);
}
$tag = $this->surrogate->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : '');
$tag = $this->surrogate->renderIncludeTag($uri, $alt, $options['ignore_errors'] ?? false, $options['comment'] ?? '');
return new Response($tag);
}

View File

@@ -73,7 +73,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
$uri = str_replace('&', '&', $uri);
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
$template = $options['default'] ?? $this->globalDefaultTemplate;
if (null !== $this->twig && $template && $this->twig->getLoader()->exists($template)) {
$content = $this->twig->render($template);
} else {

View File

@@ -97,7 +97,7 @@ class Esi extends AbstractSurrogate
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, %s, %s) ?>'."\n",
var_export($options['src'], true),
var_export(isset($options['alt']) ? $options['alt'] : '', true),
var_export($options['alt'] ?? '', true),
isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false'
);
++$i;

View File

@@ -27,12 +27,12 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
/**
* Cache-Control headers that are sent to the final response if they appear in ANY of the responses.
*/
private static $overrideDirectives = ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'];
private const OVERRIDE_DIRECTIVES = ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'];
/**
* Cache-Control headers that are sent to the final response if they appear in ALL of the responses.
*/
private static $inheritDirectives = ['public', 'immutable'];
private const INHERIT_DIRECTIVES = ['public', 'immutable'];
private $embeddedResponses = 0;
private $isNotCacheableResponseEmbedded = false;
@@ -60,13 +60,13 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
{
++$this->embeddedResponses;
foreach (self::$overrideDirectives as $directive) {
foreach (self::OVERRIDE_DIRECTIVES as $directive) {
if ($response->headers->hasCacheControlDirective($directive)) {
$this->flagDirectives[$directive] = true;
}
}
foreach (self::$inheritDirectives as $directive) {
foreach (self::INHERIT_DIRECTIVES as $directive) {
if (false !== $this->flagDirectives[$directive]) {
$this->flagDirectives[$directive] = $response->headers->hasCacheControlDirective($directive);
}

View File

@@ -69,7 +69,7 @@ class Store implements StoreInterface
if (!is_dir(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
return $path;
}
$h = fopen($path, 'cb');
$h = fopen($path, 'c');
if (!flock($h, \LOCK_EX | \LOCK_NB)) {
fclose($h);
@@ -114,7 +114,7 @@ class Store implements StoreInterface
return false;
}
$h = fopen($path, 'rb');
$h = fopen($path, 'r');
flock($h, \LOCK_EX | \LOCK_NB, $wouldBlock);
flock($h, \LOCK_UN); // release the lock we just acquired
fclose($h);
@@ -277,8 +277,8 @@ class Store implements StoreInterface
foreach (preg_split('/[\s,]+/', $vary) as $header) {
$key = str_replace('_', '-', strtolower($header));
$v1 = isset($env1[$key]) ? $env1[$key] : null;
$v2 = isset($env2[$key]) ? $env2[$key] : null;
$v1 = $env1[$key] ?? null;
$v2 = $env2[$key] ?? null;
if ($v1 !== $v2) {
return false;
}
@@ -377,7 +377,7 @@ class Store implements StoreInterface
}
$tmpFile = tempnam(\dirname($path), basename($path));
if (false === $fp = @fopen($tmpFile, 'wb')) {
if (false === $fp = @fopen($tmpFile, 'w')) {
@unlink($tmpFile);
return false;

View File

@@ -60,7 +60,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
{
$this->dispatcher = $dispatcher;
$this->resolver = $resolver;
$this->requestStack = $requestStack ?: new RequestStack();
$this->requestStack = $requestStack ?? new RequestStack();
$this->argumentResolver = $argumentResolver;
if (null === $this->argumentResolver) {

View File

@@ -74,11 +74,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private static $freshCache = [];
public const VERSION = '5.2.1';
public const VERSION_ID = 50201;
public const VERSION = '5.2.8';
public const VERSION_ID = 50208;
public const MAJOR_VERSION = 5;
public const MINOR_VERSION = 2;
public const RELEASE_VERSION = 1;
public const RELEASE_VERSION = 8;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '07/2021';
@@ -199,7 +199,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
/**
* Gets a HTTP kernel from the container.
* Gets an HTTP kernel from the container.
*
* @return HttpKernelInterface
*/
@@ -466,7 +466,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
if (!flock($lock, $wouldBlock ? \LOCK_SH : \LOCK_EX)) {
fclose($lock);
$lock = null;
} elseif (!\is_object($this->container = include $cachePath)) {
} elseif (!is_file($cachePath) || !\is_object($this->container = include $cachePath)) {
$this->container = null;
} elseif (!$oldContainer || \get_class($this->container) !== $oldContainer->name) {
flock($lock, \LOCK_UN);
@@ -543,8 +543,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
if ($collectDeprecations) {
restore_error_handler();
file_put_contents($buildDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
file_put_contents($buildDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : '');
@file_put_contents($buildDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
@file_put_contents($buildDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : '');
}
}
@@ -696,7 +696,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
if ($this instanceof CompilerPassInterface) {
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
}
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
if (class_exists(\ProxyManager\Configuration::class) && class_exists(RuntimeInstantiator::class)) {
$container->setProxyInstantiator(new RuntimeInstantiator());
}
@@ -714,7 +714,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
// cache the container
$dumper = new PhpDumper($container);
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
if (class_exists(\ProxyManager\Configuration::class) && class_exists(ProxyDumper::class)) {
$dumper->setProxyDumper(new ProxyDumper());
}
@@ -865,6 +865,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function __wakeup()
{
if (\is_object($this->environment) || \is_object($this->debug)) {
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
$this->__construct($this->environment, $this->debug);
}
}

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2020 Fabien Potencier
Copyright (c) 2004-2021 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -22,7 +22,7 @@ use Psr\Log\LogLevel;
*/
class Logger extends AbstractLogger
{
private static $levels = [
private const LEVELS = [
LogLevel::DEBUG => 0,
LogLevel::INFO => 1,
LogLevel::NOTICE => 2,
@@ -43,7 +43,7 @@ class Logger extends AbstractLogger
$minLevel = null === $output || 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::ERROR : LogLevel::WARNING;
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
switch ((int) ($_ENV['SHELL_VERBOSITY'] ?? $_SERVER['SHELL_VERBOSITY'])) {
case -1: $minLevel = LogLevel::ERROR; break;
case 1: $minLevel = LogLevel::NOTICE; break;
case 2: $minLevel = LogLevel::INFO; break;
@@ -52,11 +52,11 @@ class Logger extends AbstractLogger
}
}
if (!isset(self::$levels[$minLevel])) {
if (!isset(self::LEVELS[$minLevel])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $minLevel));
}
$this->minLevelIndex = self::$levels[$minLevel];
$this->minLevelIndex = self::LEVELS[$minLevel];
$this->formatter = $formatter ?: [$this, 'format'];
if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
@@ -70,11 +70,11 @@ class Logger extends AbstractLogger
*/
public function log($level, $message, array $context = [])
{
if (!isset(self::$levels[$level])) {
if (!isset(self::LEVELS[$level])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
}
if (self::$levels[$level] < $this->minLevelIndex) {
if (self::LEVELS[$level] < $this->minLevelIndex) {
return;
}

View File

@@ -3,8 +3,7 @@ HttpKernel Component
The HttpKernel component provides a structured process for converting a Request
into a Response by making use of the EventDispatcher component. It's flexible
enough to create a full-stack framework (Symfony), a micro-framework (Silex) or
an advanced CMS system (Drupal).
enough to create full-stack frameworks, micro-frameworks or advanced CMS systems like Drupal.
Resources
---------

File diff suppressed because one or more lines are too long

View File

@@ -99,12 +99,12 @@ class UriSigner
$url['query'] = http_build_query($params, '', '&');
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
$host = isset($url['host']) ? $url['host'] : '';
$host = $url['host'] ?? '';
$port = isset($url['port']) ? ':'.$url['port'] : '';
$user = isset($url['user']) ? $url['user'] : '';
$user = $url['user'] ?? '';
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
$pass = ($user || $pass) ? "$pass@" : '';
$path = isset($url['path']) ? $url['path'] : '';
$path = $url['path'] ?? '';
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';

View File

@@ -1,7 +1,7 @@
{
"name": "symfony/http-kernel",
"type": "library",
"description": "Symfony HttpKernel Component",
"description": "Provides a structured process for converting a Request into a Response",
"keywords": [],
"homepage": "https://symfony.com",
"license": "MIT",
@@ -41,8 +41,8 @@
"symfony/stopwatch": "^4.4|^5.0",
"symfony/translation": "^4.4|^5.0",
"symfony/translation-contracts": "^1.1|^2",
"psr/cache": "~1.0",
"twig/twig": "^2.4|^3.0"
"psr/cache": "^1.0|^2.0|^3.0",
"twig/twig": "^2.13|^3.0.4"
},
"provide": {
"psr/log-implementation": "1.0"
@@ -61,7 +61,7 @@
"symfony/translation": "<5.0",
"symfony/twig-bridge": "<5.0",
"symfony/validator": "<5.0",
"twig/twig": "<2.4"
"twig/twig": "<2.13"
},
"suggest": {
"symfony/browser-kit": "",