🔧
This commit is contained in:
@@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\Controller\ArgumentResolver\QueryParameterValue
|
||||
final class MapQueryParameter extends ValueResolver
|
||||
{
|
||||
/**
|
||||
* @see https://php.net/filter.filters.validate for filter, flags and options
|
||||
* @see https://php.net/manual/filter.constants for filter, flags and options
|
||||
*
|
||||
* @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used.
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
/**
|
||||
* @param iterable<mixed, CacheWarmerInterface> $warmers
|
||||
*/
|
||||
public function __construct(iterable $warmers = [], bool $debug = false, string $deprecationLogsFilepath = null)
|
||||
public function __construct(iterable $warmers = [], bool $debug = false, ?string $deprecationLogsFilepath = null)
|
||||
{
|
||||
$this->warmers = $warmers;
|
||||
$this->debug = $debug;
|
||||
@@ -51,7 +51,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
/**
|
||||
* @param string|null $buildDir
|
||||
*/
|
||||
public function warmUp(string $cacheDir, string|SymfonyStyle $buildDir = null, SymfonyStyle $io = null): array
|
||||
public function warmUp(string $cacheDir, string|SymfonyStyle|null $buildDir = null, ?SymfonyStyle $io = null): array
|
||||
{
|
||||
if ($buildDir instanceof SymfonyStyle) {
|
||||
trigger_deprecation('symfony/http-kernel', '6.4', 'Passing a "%s" as second argument of "%s()" is deprecated, pass it as third argument instead, after the build directory.', SymfonyStyle::class, __METHOD__);
|
||||
|
||||
@@ -30,7 +30,7 @@ class FileLocator extends BaseFileLocator
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function locate(string $file, string $currentPath = null, bool $first = true): string|array
|
||||
public function locate(string $file, ?string $currentPath = null, bool $first = true): string|array
|
||||
{
|
||||
if (isset($file[0]) && '@' === $file[0]) {
|
||||
$resource = $this->kernel->locateResource($file);
|
||||
|
||||
@@ -39,14 +39,14 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
/**
|
||||
* @param iterable<mixed, ArgumentValueResolverInterface|ValueResolverInterface> $argumentValueResolvers
|
||||
*/
|
||||
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [], ContainerInterface $namedResolvers = null)
|
||||
public function __construct(?ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [], ?ContainerInterface $namedResolvers = null)
|
||||
{
|
||||
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
|
||||
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
|
||||
$this->namedResolvers = $namedResolvers;
|
||||
}
|
||||
|
||||
public function getArguments(Request $request, callable $controller, \ReflectionFunctionAbstract $reflector = null): array
|
||||
public function getArguments(Request $request, callable $controller, ?\ReflectionFunctionAbstract $reflector = null): array
|
||||
{
|
||||
$arguments = [];
|
||||
|
||||
|
||||
@@ -40,11 +40,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @see \Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT
|
||||
* @see DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS
|
||||
*/
|
||||
private const CONTEXT_DENORMALIZE = [
|
||||
'disable_type_enforcement' => true,
|
||||
'collect_denormalization_errors' => true,
|
||||
];
|
||||
|
||||
@@ -108,11 +106,15 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
|
||||
} catch (PartialDenormalizationException $e) {
|
||||
$trans = $this->translator ? $this->translator->trans(...) : fn ($m, $p) => strtr($m, $p);
|
||||
foreach ($e->getErrors() as $error) {
|
||||
$parameters = ['{{ type }}' => implode('|', $error->getExpectedTypes())];
|
||||
$parameters = [];
|
||||
$template = 'This value was of an unexpected type.';
|
||||
if ($expectedTypes = $error->getExpectedTypes()) {
|
||||
$template = 'This value should be of type {{ type }}.';
|
||||
$parameters['{{ type }}'] = implode('|', $expectedTypes);
|
||||
}
|
||||
if ($error->canUseMessageForUser()) {
|
||||
$parameters['hint'] = $error->getMessage();
|
||||
}
|
||||
$template = 'This value should be of type {{ type }}.';
|
||||
$message = $trans($template, $parameters, 'validators');
|
||||
$violations->add(new ConstraintViolation($message, $template, $parameters, null, $error->getPath(), null));
|
||||
}
|
||||
@@ -161,7 +163,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->serializer->denormalize($data, $type, null, $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
|
||||
return $this->serializer->denormalize($data, $type, 'csv', $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
|
||||
}
|
||||
|
||||
private function mapRequestPayload(Request $request, string $type, MapRequestPayload $attribute): ?object
|
||||
@@ -175,7 +177,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
|
||||
}
|
||||
|
||||
if ($data = $request->request->all()) {
|
||||
return $this->serializer->denormalize($data, $type, null, $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
|
||||
return $this->serializer->denormalize($data, $type, 'csv', $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
|
||||
}
|
||||
|
||||
if ('' === $data = $request->getContent()) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class ContainerControllerResolver extends ControllerResolver
|
||||
{
|
||||
protected $container;
|
||||
|
||||
public function __construct(ContainerInterface $container, LoggerInterface $logger = null)
|
||||
public function __construct(ContainerInterface $container, ?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
private array $allowedControllerTypes = [];
|
||||
private array $allowedControllerAttributes = [AsController::class => AsController::class];
|
||||
|
||||
public function __construct(LoggerInterface $logger = null)
|
||||
public function __construct(?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
$r = new \ReflectionFunction($controller);
|
||||
$name = $r->name;
|
||||
|
||||
if (str_contains($name, '{closure}')) {
|
||||
if (str_contains($name, '{closure')) {
|
||||
$name = $class = \Closure::class;
|
||||
} elseif ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
|
||||
$class = $class->name;
|
||||
@@ -265,7 +265,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
}
|
||||
|
||||
if (str_contains($name, '@anonymous')) {
|
||||
$name = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $name);
|
||||
$name = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $name);
|
||||
}
|
||||
|
||||
if (-1 === $request->attributes->get('_check_controller_is_allowed')) {
|
||||
|
||||
@@ -106,7 +106,7 @@ class ArgumentMetadata
|
||||
*
|
||||
* @return array<object>
|
||||
*/
|
||||
public function getAttributes(string $name = null, int $flags = 0): array
|
||||
public function getAttributes(?string $name = null, int $flags = 0): array
|
||||
{
|
||||
if (!$name) {
|
||||
return $this->attributes;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpKernel\ControllerMetadata;
|
||||
*/
|
||||
final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
||||
{
|
||||
public function createArgumentMetadata(string|object|array $controller, \ReflectionFunctionAbstract $reflector = null): array
|
||||
public function createArgumentMetadata(string|object|array $controller, ?\ReflectionFunctionAbstract $reflector = null): array
|
||||
{
|
||||
$arguments = [];
|
||||
$reflector ??= new \ReflectionFunction($controller(...));
|
||||
|
||||
@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
class AjaxDataCollector extends DataCollector
|
||||
{
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
// all collecting is done client side
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Sets the Kernel associated with this Request.
|
||||
*/
|
||||
public function setKernel(KernelInterface $kernel = null): void
|
||||
public function setKernel(?KernelInterface $kernel = null): void
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/http-kernel', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
@@ -39,7 +39,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$this->kernel = $kernel;
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
$eom = \DateTimeImmutable::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
|
||||
$eol = \DateTimeImmutable::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
|
||||
|
||||
@@ -63,9 +63,21 @@ abstract class DataCollector implements DataCollectorInterface
|
||||
$casters = [
|
||||
'*' => function ($v, array $a, Stub $s, $isNested) {
|
||||
if (!$v instanceof Stub) {
|
||||
$b = $a;
|
||||
foreach ($a as $k => $v) {
|
||||
if (\is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) {
|
||||
$a[$k] = new CutStub($v);
|
||||
if (!\is_object($v) || $v instanceof \DateTimeInterface || $v instanceof Stub) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$a[$k] = $s = new CutStub($v);
|
||||
|
||||
if ($b[$k] === $s) {
|
||||
// we've hit a non-typed reference
|
||||
$a[$k] = $v;
|
||||
}
|
||||
} catch (\TypeError $e) {
|
||||
// we've hit a typed reference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ interface DataCollectorInterface extends ResetInterface
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null);
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null);
|
||||
|
||||
/**
|
||||
* Returns the name of the collector.
|
||||
|
||||
@@ -44,7 +44,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
private mixed $sourceContextProvider;
|
||||
private bool $webMode;
|
||||
|
||||
public function __construct(Stopwatch $stopwatch = null, string|FileLinkFormatter $fileLinkFormat = null, string $charset = null, RequestStack $requestStack = null, DataDumperInterface|Connection $dumper = null, bool $webMode = null)
|
||||
public function __construct(?Stopwatch $stopwatch = null, string|FileLinkFormatter|null $fileLinkFormat = null, ?string $charset = null, ?RequestStack $requestStack = null, DataDumperInterface|Connection|null $dumper = null, ?bool $webMode = null)
|
||||
{
|
||||
$fileLinkFormat = $fileLinkFormat ?: \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->stopwatch = $stopwatch;
|
||||
@@ -100,7 +100,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
|
||||
@@ -36,7 +36,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
* @param iterable<EventDispatcherInterface>|EventDispatcherInterface|null $dispatchers
|
||||
*/
|
||||
public function __construct(
|
||||
iterable|EventDispatcherInterface $dispatchers = null,
|
||||
iterable|EventDispatcherInterface|null $dispatchers = null,
|
||||
private ?RequestStack $requestStack = null,
|
||||
private string $defaultDispatcher = 'event_dispatcher',
|
||||
) {
|
||||
@@ -46,7 +46,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
$this->dispatchers = $dispatchers ?? [];
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMainRequest() !== $request ? $request : null;
|
||||
$this->data = [];
|
||||
@@ -86,7 +86,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function setCalledListeners(array $listeners, string $dispatcher = null): void
|
||||
public function setCalledListeners(array $listeners, ?string $dispatcher = null): void
|
||||
{
|
||||
$this->data[$dispatcher ?? $this->defaultDispatcher]['called_listeners'] = $listeners;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function getCalledListeners(string $dispatcher = null): array|Data
|
||||
public function getCalledListeners(?string $dispatcher = null): array|Data
|
||||
{
|
||||
return $this->data[$dispatcher ?? $this->defaultDispatcher]['called_listeners'] ?? [];
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function setNotCalledListeners(array $listeners, string $dispatcher = null): void
|
||||
public function setNotCalledListeners(array $listeners, ?string $dispatcher = null): void
|
||||
{
|
||||
$this->data[$dispatcher ?? $this->defaultDispatcher]['not_called_listeners'] = $listeners;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function getNotCalledListeners(string $dispatcher = null): array|Data
|
||||
public function getNotCalledListeners(?string $dispatcher = null): array|Data
|
||||
{
|
||||
return $this->data[$dispatcher ?? $this->defaultDispatcher]['not_called_listeners'] ?? [];
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
*
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function setOrphanedEvents(array $events, string $dispatcher = null): void
|
||||
public function setOrphanedEvents(array $events, ?string $dispatcher = null): void
|
||||
{
|
||||
$this->data[$dispatcher ?? $this->defaultDispatcher]['orphaned_events'] = $events;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
/**
|
||||
* @see TraceableEventDispatcher
|
||||
*/
|
||||
public function getOrphanedEvents(string $dispatcher = null): array|Data
|
||||
public function getOrphanedEvents(?string $dispatcher = null): array|Data
|
||||
{
|
||||
return $this->data[$dispatcher ?? $this->defaultDispatcher]['orphaned_events'] ?? [];
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
class ExceptionDataCollector extends DataCollector
|
||||
{
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
if (null !== $exception) {
|
||||
$this->data = [
|
||||
|
||||
@@ -32,14 +32,14 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
private ?RequestStack $requestStack;
|
||||
private ?array $processedLogs = null;
|
||||
|
||||
public function __construct(object $logger = null, string $containerPathPrefix = null, RequestStack $requestStack = null)
|
||||
public function __construct(?object $logger = null, ?string $containerPathPrefix = null, ?RequestStack $requestStack = null)
|
||||
{
|
||||
$this->logger = DebugLoggerConfigurator::getDebugLogger($logger);
|
||||
$this->containerPathPrefix = $containerPathPrefix;
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
$this->currentRequest = $this->requestStack && $this->requestStack->getMainRequest() !== $request ? $request : null;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
return $logs;
|
||||
}
|
||||
|
||||
private function getContainerCompilerLogs(string $compilerLogsFilepath = null): array
|
||||
private function getContainerCompilerLogs(?string $compilerLogsFilepath = null): array
|
||||
{
|
||||
if (!$compilerLogsFilepath || !is_file($compilerLogsFilepath)) {
|
||||
return [];
|
||||
|
||||
@@ -26,7 +26,7 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
private array $sessionUsages = [];
|
||||
private ?RequestStack $requestStack;
|
||||
|
||||
public function __construct(RequestStack $requestStack = null)
|
||||
public function __construct(?RequestStack $requestStack = null)
|
||||
{
|
||||
$this->controllers = new \SplObjectStorage();
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
// attributes are serialized and as they can be anything, they need to be converted to strings.
|
||||
$attributes = [];
|
||||
@@ -63,7 +63,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
$sessionMetadata = [];
|
||||
$sessionAttributes = [];
|
||||
$flashes = [];
|
||||
if ($request->hasSession()) {
|
||||
if (!$request->attributes->getBoolean('_stateless') && $request->hasSession()) {
|
||||
$session = $request->getSession();
|
||||
if ($session->isStarted()) {
|
||||
$sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated());
|
||||
@@ -505,7 +505,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
'line' => $r->getStartLine(),
|
||||
];
|
||||
|
||||
if (str_contains($r->name, '{closure}')) {
|
||||
if (str_contains($r->name, '{closure')) {
|
||||
return $controller;
|
||||
}
|
||||
$controller['method'] = $r->name;
|
||||
|
||||
@@ -34,7 +34,7 @@ class RouterDataCollector extends DataCollector
|
||||
/**
|
||||
* @final
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
if ($response instanceof RedirectResponse) {
|
||||
$this->data['redirect'] = true;
|
||||
|
||||
@@ -27,14 +27,14 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
private ?KernelInterface $kernel;
|
||||
private ?Stopwatch $stopwatch;
|
||||
|
||||
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
|
||||
public function __construct(?KernelInterface $kernel = null, ?Stopwatch $stopwatch = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->stopwatch = $stopwatch;
|
||||
$this->data = ['events' => [], 'stopwatch_installed' => false, 'start_time' => 0];
|
||||
}
|
||||
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): void
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
||||
{
|
||||
if (null !== $this->kernel) {
|
||||
$startTime = $this->kernel->getStartTime();
|
||||
|
||||
@@ -36,7 +36,7 @@ class ErrorHandlerConfigurator
|
||||
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
|
||||
* @param bool $scope Enables/disables scoping mode
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger = null, array|int|null $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, bool $scope = true, LoggerInterface $deprecationLogger = null)
|
||||
public function __construct(?LoggerInterface $logger = null, array|int|null $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, bool $scope = true, ?LoggerInterface $deprecationLogger = null)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->levels = $levels ?? \E_ALL;
|
||||
|
||||
@@ -66,7 +66,11 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
|
||||
if (null === $sectionId) {
|
||||
break;
|
||||
}
|
||||
$this->stopwatch->stopSection($sectionId);
|
||||
try {
|
||||
$this->stopwatch->stopSection($sectionId);
|
||||
} catch (\LogicException) {
|
||||
// The stop watch service might have been reset in the meantime
|
||||
}
|
||||
break;
|
||||
case KernelEvents::TERMINATE:
|
||||
// In the special case described in the `preDispatch` method above, the `$token` section
|
||||
|
||||
@@ -30,7 +30,9 @@ class LoggerPass implements CompilerPassInterface
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$container->setAlias(LoggerInterface::class, 'logger');
|
||||
if (!$container->has(LoggerInterface::class)) {
|
||||
$container->setAlias(LoggerInterface::class, 'logger');
|
||||
}
|
||||
|
||||
if ($container->has('logger')) {
|
||||
return;
|
||||
|
||||
@@ -45,6 +45,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
|
||||
$parameterBag = $container->getParameterBag();
|
||||
$controllers = [];
|
||||
$controllerClasses = [];
|
||||
|
||||
$publicAliases = [];
|
||||
foreach ($container->getAliases() as $id => $alias) {
|
||||
@@ -58,6 +59,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
foreach ($container->findTaggedServiceIds('controller.service_arguments', true) as $id => $tags) {
|
||||
$def = $container->getDefinition($id);
|
||||
$def->setPublic(true);
|
||||
$def->setLazy(false);
|
||||
$class = $def->getClass();
|
||||
$autowire = $def->isAutowired();
|
||||
$bindings = $def->getBindings();
|
||||
@@ -74,6 +76,8 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
|
||||
}
|
||||
|
||||
$controllerClasses[] = $class;
|
||||
|
||||
// get regular public methods
|
||||
$methods = [];
|
||||
$arguments = [];
|
||||
@@ -155,7 +159,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
continue;
|
||||
} elseif (!$autowire || (!($autowireAttributes ??= $p->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF)) && (!$type || '\\' !== $target[0]))) {
|
||||
continue;
|
||||
} elseif (is_subclass_of($type, \UnitEnum::class)) {
|
||||
} elseif (!$autowireAttributes && is_subclass_of($type, \UnitEnum::class)) {
|
||||
// do not attempt to register enum typed arguments if not already present in bindings
|
||||
continue;
|
||||
} elseif (!$p->allowsNull()) {
|
||||
@@ -227,5 +231,10 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
$container->setAlias('argument_resolver.controller_locator', (string) $controllerLocatorRef);
|
||||
|
||||
if ($container->hasDefinition('controller_resolver')) {
|
||||
$container->getDefinition('controller_resolver')
|
||||
->addMethodCall('allowControllers', [array_unique($controllerClasses)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ final class ControllerArgumentsEvent extends KernelEvent
|
||||
/**
|
||||
* @param array<class-string, list<object>>|null $attributes
|
||||
*/
|
||||
public function setController(callable $controller, array $attributes = null): void
|
||||
public function setController(callable $controller, ?array $attributes = null): void
|
||||
{
|
||||
$this->controllerEvent->setController($controller, $attributes);
|
||||
unset($this->namedArguments);
|
||||
@@ -102,7 +102,7 @@ final class ControllerArgumentsEvent extends KernelEvent
|
||||
*
|
||||
* @psalm-return (T is null ? array<class-string, list<object>> : list<object>)
|
||||
*/
|
||||
public function getAttributes(string $className = null): array
|
||||
public function getAttributes(?string $className = null): array
|
||||
{
|
||||
return $this->controllerEvent->getAttributes($className);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ final class ControllerEvent extends KernelEvent
|
||||
/**
|
||||
* @param array<class-string, list<object>>|null $attributes
|
||||
*/
|
||||
public function setController(callable $controller, array $attributes = null): void
|
||||
public function setController(callable $controller, ?array $attributes = null): void
|
||||
{
|
||||
if (null !== $attributes) {
|
||||
$this->attributes = $attributes;
|
||||
@@ -70,7 +70,7 @@ final class ControllerEvent extends KernelEvent
|
||||
if (\is_array($controller) && method_exists(...$controller)) {
|
||||
$this->controllerReflector = new \ReflectionMethod(...$controller);
|
||||
} elseif (\is_string($controller) && str_contains($controller, '::')) {
|
||||
$this->controllerReflector = new \ReflectionMethod($controller);
|
||||
$this->controllerReflector = new \ReflectionMethod(...explode('::', $controller, 2));
|
||||
} else {
|
||||
$this->controllerReflector = new \ReflectionFunction($controller(...));
|
||||
}
|
||||
@@ -87,7 +87,7 @@ final class ControllerEvent extends KernelEvent
|
||||
*
|
||||
* @psalm-return (T is null ? array<class-string, list<object>> : list<object>)
|
||||
*/
|
||||
public function getAttributes(string $className = null): array
|
||||
public function getAttributes(?string $className = null): array
|
||||
{
|
||||
if (isset($this->attributes)) {
|
||||
return null === $className ? $this->attributes : $this->attributes[$className] ?? [];
|
||||
@@ -98,7 +98,7 @@ final class ControllerEvent extends KernelEvent
|
||||
} elseif (\is_string($this->controller) && false !== $i = strpos($this->controller, '::')) {
|
||||
$class = new \ReflectionClass(substr($this->controller, 0, $i));
|
||||
} else {
|
||||
$class = str_contains($this->controllerReflector->name, '{closure}') ? null : (\PHP_VERSION_ID >= 80111 ? $this->controllerReflector->getClosureCalledClass() : $this->controllerReflector->getClosureScopeClass());
|
||||
$class = str_contains($this->controllerReflector->name, '{closure') ? null : (\PHP_VERSION_ID >= 80111 ? $this->controllerReflector->getClosureCalledClass() : $this->controllerReflector->getClosureScopeClass());
|
||||
}
|
||||
$this->attributes = [];
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Base class for events thrown in the HttpKernel component.
|
||||
* Base class for events dispatched in the HttpKernel component.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ final class ViewEvent extends RequestEvent
|
||||
public readonly ?ControllerArgumentsEvent $controllerArgumentsEvent;
|
||||
private mixed $controllerResult;
|
||||
|
||||
public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, mixed $controllerResult, ControllerArgumentsEvent $controllerArgumentsEvent = null)
|
||||
public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, mixed $controllerResult, ?ControllerArgumentsEvent $controllerArgumentsEvent = null)
|
||||
{
|
||||
parent::__construct($kernel, $request, $requestType);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(ContainerInterface $container = null, bool $debug = false, array $sessionOptions = [])
|
||||
public function __construct(?ContainerInterface $container = null, bool $debug = false, array $sessionOptions = [])
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->debug = $debug;
|
||||
|
||||
@@ -41,13 +41,14 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
* @param bool $webMode
|
||||
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
|
||||
*/
|
||||
public function __construct(callable $exceptionHandler = null, bool|LoggerInterface $webMode = null)
|
||||
public function __construct(?callable $exceptionHandler = null, bool|LoggerInterface|null $webMode = null)
|
||||
{
|
||||
if ($webMode instanceof LoggerInterface) {
|
||||
// BC with Symfony 5
|
||||
$webMode = null;
|
||||
}
|
||||
$handler = set_exception_handler('is_int');
|
||||
|
||||
$handler = set_exception_handler('var_dump');
|
||||
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_exception_handler();
|
||||
|
||||
@@ -58,7 +59,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
/**
|
||||
* Configures the error handler.
|
||||
*/
|
||||
public function configure(object $event = null): void
|
||||
public function configure(?object $event = null): void
|
||||
{
|
||||
if ($event instanceof ConsoleEvent && $this->webMode) {
|
||||
return;
|
||||
@@ -67,6 +68,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
$this->firstCall = $this->hasTerminatedWithException = false;
|
||||
$hasRun = null;
|
||||
|
||||
if (!$this->exceptionHandler) {
|
||||
if ($event instanceof KernelEvent) {
|
||||
@@ -93,7 +95,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
if ($this->exceptionHandler) {
|
||||
$handler = set_exception_handler(static fn () => null);
|
||||
$handler = set_exception_handler('var_dump');
|
||||
$handler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_exception_handler();
|
||||
|
||||
@@ -103,6 +105,19 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
$handler->setExceptionHandler($this->exceptionHandler);
|
||||
if (null !== $hasRun) {
|
||||
$throwAt = $handler->throwAt(0) | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR | \E_USER_ERROR | \E_RECOVERABLE_ERROR | \E_PARSE;
|
||||
$loggers = [];
|
||||
|
||||
foreach ($handler->setLoggers([]) as $type => $log) {
|
||||
if ($type & $throwAt) {
|
||||
$loggers[$type] = [null, $log[1]];
|
||||
}
|
||||
}
|
||||
|
||||
// Assume $kernel->terminateWithException() will log uncaught exceptions appropriately
|
||||
$handler->setLoggers($loggers);
|
||||
}
|
||||
}
|
||||
$this->exceptionHandler = null;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class DumpListener implements EventSubscriberInterface
|
||||
private DataDumperInterface $dumper;
|
||||
private ?Connection $connection;
|
||||
|
||||
public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper, Connection $connection = null)
|
||||
public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper, ?Connection $connection = null)
|
||||
{
|
||||
$this->cloner = $cloner;
|
||||
$this->dumper = $dumper;
|
||||
@@ -45,7 +45,7 @@ class DumpListener implements EventSubscriberInterface
|
||||
$dumper = $this->dumper;
|
||||
$connection = $this->connection;
|
||||
|
||||
VarDumper::setHandler(static function ($var, string $label = null) use ($cloner, $dumper, $connection) {
|
||||
VarDumper::setHandler(static function ($var, ?string $label = null) use ($cloner, $dumper, $connection) {
|
||||
$data = $cloner->cloneVar($var);
|
||||
if (null !== $label) {
|
||||
$data = $data->withContext(['label' => $label]);
|
||||
|
||||
@@ -44,7 +44,7 @@ class ErrorListener implements EventSubscriberInterface
|
||||
/**
|
||||
* @param array<class-string, array{log_level: string|null, status_code: int<100,599>|null}> $exceptionsMapping
|
||||
*/
|
||||
public function __construct(string|object|array|null $controller, LoggerInterface $logger = null, bool $debug = false, array $exceptionsMapping = [])
|
||||
public function __construct(string|object|array|null $controller, ?LoggerInterface $logger = null, bool $debug = false, array $exceptionsMapping = [])
|
||||
{
|
||||
$this->controller = $controller;
|
||||
$this->logger = $logger;
|
||||
@@ -104,11 +104,11 @@ class ErrorListener implements EventSubscriberInterface
|
||||
|
||||
$throwable = $event->getThrowable();
|
||||
|
||||
if ($exceptionHandler = set_exception_handler(var_dump(...))) {
|
||||
restore_exception_handler();
|
||||
if (\is_array($exceptionHandler) && $exceptionHandler[0] instanceof ErrorHandler) {
|
||||
$throwable = $exceptionHandler[0]->enhanceError($event->getThrowable());
|
||||
}
|
||||
$exceptionHandler = set_exception_handler('var_dump');
|
||||
restore_exception_handler();
|
||||
|
||||
if (\is_array($exceptionHandler) && $exceptionHandler[0] instanceof ErrorHandler) {
|
||||
$throwable = $exceptionHandler[0]->enhanceError($event->getThrowable());
|
||||
}
|
||||
|
||||
$request = $this->duplicateRequest($throwable, $event->getRequest());
|
||||
@@ -183,7 +183,7 @@ class ErrorListener implements EventSubscriberInterface
|
||||
/**
|
||||
* Logs an exception.
|
||||
*/
|
||||
protected function logException(\Throwable $exception, string $message, string $logLevel = null): void
|
||||
protected function logException(\Throwable $exception, string $message, ?string $logLevel = null): void
|
||||
{
|
||||
if (null === $this->logger) {
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ class LocaleListener implements EventSubscriberInterface
|
||||
private bool $useAcceptLanguageHeader;
|
||||
private array $enabledLocales;
|
||||
|
||||
public function __construct(RequestStack $requestStack, string $defaultLocale = 'en', RequestContextAwareInterface $router = null, bool $useAcceptLanguageHeader = false, array $enabledLocales = [])
|
||||
public function __construct(RequestStack $requestStack, string $defaultLocale = 'en', ?RequestContextAwareInterface $router = null, bool $useAcceptLanguageHeader = false, array $enabledLocales = [])
|
||||
{
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
$this->requestStack = $requestStack;
|
||||
|
||||
@@ -48,7 +48,7 @@ class ProfilerListener implements EventSubscriberInterface
|
||||
* @param bool $onlyException True if the profiler only collects data when an exception occurs, false otherwise
|
||||
* @param bool $onlyMainRequests True if the profiler only collects data when the request is the main request, false otherwise
|
||||
*/
|
||||
public function __construct(Profiler $profiler, RequestStack $requestStack, RequestMatcherInterface $matcher = null, bool $onlyException = false, bool $onlyMainRequests = false, string $collectParameter = null)
|
||||
public function __construct(Profiler $profiler, RequestStack $requestStack, ?RequestMatcherInterface $matcher = null, bool $onlyException = false, bool $onlyMainRequests = false, ?string $collectParameter = null)
|
||||
{
|
||||
$this->profiler = $profiler;
|
||||
$this->matcher = $matcher;
|
||||
@@ -97,7 +97,7 @@ class ProfilerListener implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$session = $request->hasPreviousSession() ? $request->getSession() : null;
|
||||
$session = !$request->attributes->getBoolean('_stateless') && $request->hasPreviousSession() ? $request->getSession() : null;
|
||||
|
||||
if ($session instanceof Session) {
|
||||
$usageIndexValue = $usageIndexReference = &$session->getUsageIndex();
|
||||
|
||||
@@ -53,7 +53,7 @@ class RouterListener implements EventSubscriberInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(UrlMatcherInterface|RequestMatcherInterface $matcher, RequestStack $requestStack, RequestContext $context = null, LoggerInterface $logger = null, string $projectDir = null, bool $debug = true)
|
||||
public function __construct(UrlMatcherInterface|RequestMatcherInterface $matcher, RequestStack $requestStack, ?RequestContext $context = null, ?LoggerInterface $logger = null, ?string $projectDir = null, bool $debug = true)
|
||||
{
|
||||
if (null === $context && !$matcher instanceof RequestContextAwareInterface) {
|
||||
throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.');
|
||||
|
||||
@@ -28,7 +28,7 @@ class SurrogateListener implements EventSubscriberInterface
|
||||
{
|
||||
private ?SurrogateInterface $surrogate;
|
||||
|
||||
public function __construct(SurrogateInterface $surrogate = null)
|
||||
public function __construct(?SurrogateInterface $surrogate = null)
|
||||
{
|
||||
$this->surrogate = $surrogate;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class AccessDeniedHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class BadRequestHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class ConflictHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class GoneHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface
|
||||
private int $statusCode;
|
||||
private array $headers;
|
||||
|
||||
public function __construct(int $statusCode, string $message = '', \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;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class LengthRequiredHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class LockedHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
public function __construct(string $message = '', ?\Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
parent::__construct(423, $message, $previous, $headers, $code);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class MethodNotAllowedHttpException extends HttpException
|
||||
/**
|
||||
* @param string[] $allow An array of allowed methods
|
||||
*/
|
||||
public function __construct(array $allow, string $message = '', \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));
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class NotAcceptableHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class NotFoundHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class PreconditionFailedHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class PreconditionRequiredHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ServiceUnavailableHttpException extends HttpException
|
||||
/**
|
||||
* @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
*/
|
||||
public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
public function __construct(int|string|null $retryAfter = null, string $message = '', ?\Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
if ($retryAfter) {
|
||||
$headers['Retry-After'] = $retryAfter;
|
||||
|
||||
@@ -21,7 +21,7 @@ class TooManyRequestsHttpException extends HttpException
|
||||
/**
|
||||
* @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
*/
|
||||
public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
public function __construct(int|string|null $retryAfter = null, string $message = '', ?\Throwable $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
if ($retryAfter) {
|
||||
$headers['Retry-After'] = $retryAfter;
|
||||
|
||||
@@ -19,7 +19,7 @@ class UnauthorizedHttpException extends HttpException
|
||||
/**
|
||||
* @param string $challenge WWW-Authenticate challenge string
|
||||
*/
|
||||
public function __construct(string $challenge, string $message = '', \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;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class UnprocessableEntityHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
class UnsupportedMediaTypeHttpException extends HttpException
|
||||
{
|
||||
public function __construct(string $message = '', \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);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
|
||||
*
|
||||
* @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported
|
||||
*/
|
||||
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null)
|
||||
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, ?UriSigner $signer = null)
|
||||
{
|
||||
$this->surrogate = $surrogate;
|
||||
$this->inlineStrategy = $inlineStrategy;
|
||||
|
||||
@@ -28,14 +28,14 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
private ?UriSigner $signer;
|
||||
private ?RequestStack $requestStack;
|
||||
|
||||
public function __construct(string $fragmentPath, UriSigner $signer = null, RequestStack $requestStack = null)
|
||||
public function __construct(string $fragmentPath, ?UriSigner $signer = null, ?RequestStack $requestStack = null)
|
||||
{
|
||||
$this->fragmentPath = $fragmentPath;
|
||||
$this->signer = $signer;
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
public function generate(ControllerReference $controller, Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string
|
||||
public function generate(ControllerReference $controller, ?Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string
|
||||
{
|
||||
if (null === $request && (null === $this->requestStack || null === $request = $this->requestStack->getCurrentRequest())) {
|
||||
throw new \LogicException('Generating a fragment URL can only be done when handling a Request.');
|
||||
|
||||
@@ -28,5 +28,5 @@ interface FragmentUriGeneratorInterface
|
||||
* @param bool $strict Whether to allow non-scalar attributes or not
|
||||
* @param bool $sign Whether to sign the URL or not
|
||||
*/
|
||||
public function generate(ControllerReference $controller, Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string;
|
||||
public function generate(ControllerReference $controller, ?Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
/**
|
||||
* @param string|null $globalDefaultTemplate The global default content (it can be a template name or the content)
|
||||
*/
|
||||
public function __construct(Environment $twig = null, UriSigner $signer = null, string $globalDefaultTemplate = null, string $charset = 'utf-8')
|
||||
public function __construct(?Environment $twig = null, ?UriSigner $signer = null, ?string $globalDefaultTemplate = null, string $charset = 'utf-8')
|
||||
{
|
||||
$this->twig = $twig;
|
||||
$this->globalDefaultTemplate = $globalDefaultTemplate;
|
||||
|
||||
@@ -30,7 +30,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
private HttpKernelInterface $kernel;
|
||||
private ?EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null)
|
||||
public function __construct(HttpKernelInterface $kernel, ?EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
@@ -42,7 +42,7 @@ class Esi extends AbstractSurrogate
|
||||
}
|
||||
}
|
||||
|
||||
public function renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
|
||||
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
|
||||
{
|
||||
$html = sprintf('<esi:include src="%s"%s%s />',
|
||||
$uri,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\HttpCache;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
@@ -89,7 +90,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
* Unless your application needs to process events on cache hits, it is recommended
|
||||
* to set this to false to avoid having to bootstrap the Symfony framework on a cache hit.
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = [])
|
||||
public function __construct(HttpKernelInterface $kernel, StoreInterface $store, ?SurrogateInterface $surrogate = null, array $options = [])
|
||||
{
|
||||
$this->store = $store;
|
||||
$this->kernel = $kernel;
|
||||
@@ -237,7 +238,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
$response->prepare($request);
|
||||
|
||||
$response->isNotModified($request);
|
||||
if (HttpKernelInterface::MAIN_REQUEST === $type) {
|
||||
$response->isNotModified($request);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -465,7 +468,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function forward(Request $request, bool $catch = false, Response $entry = null)
|
||||
protected function forward(Request $request, bool $catch = false, ?Response $entry = null)
|
||||
{
|
||||
$this->surrogate?->addSurrogateCapability($request);
|
||||
|
||||
@@ -723,7 +726,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$path .= '?'.$qs;
|
||||
}
|
||||
|
||||
return $request->getMethod().' '.$path;
|
||||
try {
|
||||
return $request->getMethod().' '.$path;
|
||||
} catch (SuspiciousOperationException $e) {
|
||||
return '_BAD_METHOD_ '.$path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
private array $ageDirectives = [
|
||||
'max-age' => null,
|
||||
's-maxage' => null,
|
||||
'expires' => null,
|
||||
'expires' => false,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -82,15 +82,30 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$isHeuristicallyCacheable = $response->headers->hasCacheControlDirective('public');
|
||||
$maxAge = $response->headers->hasCacheControlDirective('max-age') ? (int) $response->headers->getCacheControlDirective('max-age') : null;
|
||||
$this->storeRelativeAgeDirective('max-age', $maxAge, $age, $isHeuristicallyCacheable);
|
||||
$sharedMaxAge = $response->headers->hasCacheControlDirective('s-maxage') ? (int) $response->headers->getCacheControlDirective('s-maxage') : $maxAge;
|
||||
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $age, $isHeuristicallyCacheable);
|
||||
|
||||
$expires = $response->getExpires();
|
||||
$expires = null !== $expires ? (int) $expires->format('U') - (int) $response->getDate()->format('U') : null;
|
||||
$this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0, $isHeuristicallyCacheable);
|
||||
|
||||
// See https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2
|
||||
// If a response is "public" but does not have maximum lifetime, heuristics might be applied.
|
||||
// Do not store NULL values so the final response can have more limiting value from other responses.
|
||||
$isHeuristicallyCacheable = $response->headers->hasCacheControlDirective('public')
|
||||
&& null === $maxAge
|
||||
&& null === $sharedMaxAge
|
||||
&& null === $expires;
|
||||
|
||||
if (!$isHeuristicallyCacheable || null !== $maxAge || null !== $expires) {
|
||||
$this->storeRelativeAgeDirective('max-age', $maxAge, $expires, $age);
|
||||
}
|
||||
|
||||
if (!$isHeuristicallyCacheable || null !== $sharedMaxAge || null !== $expires) {
|
||||
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $expires, $age);
|
||||
}
|
||||
|
||||
if (null !== $expires) {
|
||||
$this->ageDirectives['expires'] = true;
|
||||
}
|
||||
|
||||
if (false !== $this->lastModified) {
|
||||
$lastModified = $response->getLastModified();
|
||||
@@ -152,9 +167,9 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($this->ageDirectives['expires'])) {
|
||||
if ($this->ageDirectives['expires'] && null !== $maxAge) {
|
||||
$date = clone $response->getDate();
|
||||
$date = $date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
|
||||
$date = $date->modify('+'.$maxAge.' seconds');
|
||||
$response->setExpires($date);
|
||||
}
|
||||
}
|
||||
@@ -204,33 +219,16 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||
* we have to subtract the age so that the value is normalized for an age of 0.
|
||||
*
|
||||
* If the value is lower than the currently stored value, we update the value, to keep a rolling
|
||||
* minimal value of each instruction.
|
||||
*
|
||||
* If the value is NULL and the isHeuristicallyCacheable parameter is false, the directive will
|
||||
* not be set on the final response. In this case, not all responses had the directive set and no
|
||||
* value can be found that satisfies the requirements of all responses. The directive will be dropped
|
||||
* from the final response.
|
||||
*
|
||||
* If the isHeuristicallyCacheable parameter is true, however, the current response has been marked
|
||||
* as cacheable in a public (shared) cache, but did not provide an explicit lifetime that would serve
|
||||
* as an upper bound. In this case, we can proceed and possibly keep the directive on the final response.
|
||||
* minimal value of each instruction. If the value is NULL, the directive will not be set on the final response.
|
||||
*/
|
||||
private function storeRelativeAgeDirective(string $directive, ?int $value, int $age, bool $isHeuristicallyCacheable): void
|
||||
private function storeRelativeAgeDirective(string $directive, ?int $value, ?int $expires, int $age): void
|
||||
{
|
||||
if (null === $value) {
|
||||
if ($isHeuristicallyCacheable) {
|
||||
/*
|
||||
* See https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2
|
||||
* This particular response does not require maximum lifetime; heuristics might be applied.
|
||||
* Other responses, however, might have more stringent requirements on maximum lifetime.
|
||||
* So, return early here so that the final response can have the more limiting value set.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
if (null === $value && null === $expires) {
|
||||
$this->ageDirectives[$directive] = false;
|
||||
}
|
||||
|
||||
if (false !== $this->ageDirectives[$directive]) {
|
||||
$value = min($value ?? PHP_INT_MAX, $expires ?? PHP_INT_MAX);
|
||||
$value -= $age;
|
||||
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
|
||||
}
|
||||
|
||||
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
@@ -36,7 +36,7 @@ class Ssi extends AbstractSurrogate
|
||||
}
|
||||
}
|
||||
|
||||
public function renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
|
||||
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
|
||||
{
|
||||
return sprintf('<!--#include virtual="%s" -->', $uri);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ class Store implements StoreInterface
|
||||
/**
|
||||
* Restores a Response from the HTTP headers and body.
|
||||
*/
|
||||
private function restoreResponse(array $headers, string $path = null): ?Response
|
||||
private function restoreResponse(array $headers, ?string $path = null): ?Response
|
||||
{
|
||||
$status = $headers['X-Status'][0];
|
||||
unset($headers['X-Status']);
|
||||
|
||||
@@ -58,7 +58,7 @@ interface SurrogateInterface
|
||||
* @param string|null $alt An alternate URI
|
||||
* @param string $comment A comment to add as an esi:include tag
|
||||
*/
|
||||
public function renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = ''): string;
|
||||
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string;
|
||||
|
||||
/**
|
||||
* Replaces a Response Surrogate tags with the included resource content.
|
||||
|
||||
@@ -33,7 +33,7 @@ final class HttpClientKernel implements HttpKernelInterface
|
||||
{
|
||||
private HttpClientInterface $client;
|
||||
|
||||
public function __construct(HttpClientInterface $client = null)
|
||||
public function __construct(?HttpClientInterface $client = null)
|
||||
{
|
||||
if (null === $client && !class_exists(HttpClient::class)) {
|
||||
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
|
||||
|
||||
4
vendor/symfony/http-kernel/HttpKernel.php
vendored
4
vendor/symfony/http-kernel/HttpKernel.php
vendored
@@ -57,7 +57,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
private ArgumentResolverInterface $argumentResolver;
|
||||
private bool $handleAllThrowables;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null, ArgumentResolverInterface $argumentResolver = null, bool $handleAllThrowables = false)
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, ?RequestStack $requestStack = null, ?ArgumentResolverInterface $argumentResolver = null, bool $handleAllThrowables = false)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
@@ -118,7 +118,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function terminateWithException(\Throwable $exception, Request $request = null): void
|
||||
public function terminateWithException(\Throwable $exception, ?Request $request = null): void
|
||||
{
|
||||
if (!$request ??= $this->requestStack->getMainRequest()) {
|
||||
throw $exception;
|
||||
|
||||
@@ -36,7 +36,7 @@ class HttpKernelBrowser extends AbstractBrowser
|
||||
/**
|
||||
* @param array $server The server parameters (equivalent of $_SERVER)
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
|
||||
{
|
||||
// These class properties must be set before calling the parent constructor, as it may depend on it.
|
||||
$this->kernel = $kernel;
|
||||
|
||||
21
vendor/symfony/http-kernel/Kernel.php
vendored
21
vendor/symfony/http-kernel/Kernel.php
vendored
@@ -76,11 +76,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
*/
|
||||
private static array $freshCache = [];
|
||||
|
||||
public const VERSION = '6.4.2';
|
||||
public const VERSION_ID = 60402;
|
||||
public const VERSION = '6.4.21';
|
||||
public const VERSION_ID = 60421;
|
||||
public const MAJOR_VERSION = 6;
|
||||
public const MINOR_VERSION = 4;
|
||||
public const RELEASE_VERSION = 2;
|
||||
public const RELEASE_VERSION = 21;
|
||||
public const EXTRA_VERSION = '';
|
||||
|
||||
public const END_OF_MAINTENANCE = '11/2026';
|
||||
@@ -407,7 +407,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
$cachePath = $cache->getPath();
|
||||
|
||||
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
|
||||
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
|
||||
$errorLevel = error_reporting();
|
||||
error_reporting($errorLevel & ~\E_WARNING);
|
||||
|
||||
try {
|
||||
if (is_file($cachePath) && \is_object($this->container = include $cachePath)
|
||||
@@ -539,10 +540,18 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
touch($oldContainerDir.'.legacy');
|
||||
}
|
||||
|
||||
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir) : [];
|
||||
$buildDir = $this->container->getParameter('kernel.build_dir');
|
||||
$cacheDir = $this->container->getParameter('kernel.cache_dir');
|
||||
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($cacheDir, $buildDir) : [];
|
||||
|
||||
if ($this->container->has('cache_warmer')) {
|
||||
$preload = array_merge($preload, (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir));
|
||||
$cacheWarmer = $this->container->get('cache_warmer');
|
||||
|
||||
if ($cacheDir !== $buildDir) {
|
||||
$cacheWarmer->enableOptionalWarmers();
|
||||
}
|
||||
|
||||
$preload = array_merge($preload, (array) $cacheWarmer->warmUp($cacheDir, $buildDir));
|
||||
}
|
||||
|
||||
if ($preload && file_exists($preloadFile = $buildDir.'/'.$class.'.preload.php')) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class DebugLoggerConfigurator
|
||||
{
|
||||
private ?object $processor = null;
|
||||
|
||||
public function __construct(callable $processor, bool $enable = null)
|
||||
public function __construct(callable $processor, ?bool $enable = null)
|
||||
{
|
||||
if ($enable ?? !\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||
$this->processor = \is_object($processor) ? $processor : $processor(...);
|
||||
|
||||
@@ -33,14 +33,14 @@ interface DebugLoggerInterface
|
||||
* timestamp_rfc3339: string,
|
||||
* }>
|
||||
*/
|
||||
public function getLogs(Request $request = null);
|
||||
public function getLogs(?Request $request = null);
|
||||
|
||||
/**
|
||||
* Returns the number of errors.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function countErrors(Request $request = null);
|
||||
public function countErrors(?Request $request = null);
|
||||
|
||||
/**
|
||||
* Removes all log records.
|
||||
|
||||
8
vendor/symfony/http-kernel/Log/Logger.php
vendored
8
vendor/symfony/http-kernel/Log/Logger.php
vendored
@@ -57,7 +57,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
|
||||
/**
|
||||
* @param string|resource|null $output
|
||||
*/
|
||||
public function __construct(string $minLevel = null, $output = null, callable $formatter = null, private readonly ?RequestStack $requestStack = null, bool $debug = false)
|
||||
public function __construct(?string $minLevel = null, $output = null, ?callable $formatter = null, private readonly ?RequestStack $requestStack = null, bool $debug = false)
|
||||
{
|
||||
if (null === $minLevel) {
|
||||
$minLevel = null === $output || 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::ERROR : LogLevel::WARNING;
|
||||
@@ -79,7 +79,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
|
||||
|
||||
$this->minLevelIndex = self::LEVELS[$minLevel];
|
||||
$this->formatter = null !== $formatter ? $formatter(...) : $this->format(...);
|
||||
if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
|
||||
if ($output && false === $this->handle = \is_string($output) ? @fopen($output, 'a') : $output) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
|
||||
}
|
||||
$this->debug = $debug;
|
||||
@@ -112,7 +112,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function getLogs(Request $request = null): array
|
||||
public function getLogs(?Request $request = null): array
|
||||
{
|
||||
if ($request) {
|
||||
return $this->logs[spl_object_id($request)] ?? [];
|
||||
@@ -121,7 +121,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
|
||||
return array_merge(...array_values($this->logs));
|
||||
}
|
||||
|
||||
public function countErrors(Request $request = null): int
|
||||
public function countErrors(?Request $request = null): int
|
||||
{
|
||||
if ($request) {
|
||||
return $this->errorCount[spl_object_id($request)] ?? 0;
|
||||
|
||||
@@ -45,7 +45,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* @param \Closure|null $filter A filter to apply on the list of tokens
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, string $statusCode = null/* , \Closure $filter = null */): array
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null, ?string $statusCode = null/* , \Closure $filter = null */): array
|
||||
{
|
||||
$filter = 7 < \func_num_args() ? func_get_arg(7) : null;
|
||||
$file = $this->getIndexFilename();
|
||||
@@ -59,7 +59,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
|
||||
$result = [];
|
||||
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
|
||||
$values = str_getcsv($line);
|
||||
$values = str_getcsv($line, ',', '"', '\\');
|
||||
|
||||
if (7 > \count($values)) {
|
||||
// skip invalid lines
|
||||
@@ -193,7 +193,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
$profile->getParentToken(),
|
||||
$profile->getStatusCode(),
|
||||
$profile->getVirtualType() ?? 'request',
|
||||
]);
|
||||
], ',', '"', '\\');
|
||||
fclose($file);
|
||||
|
||||
if (1 === mt_rand(1, 10)) {
|
||||
@@ -272,7 +272,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* @return Profile
|
||||
*/
|
||||
protected function createProfileFromData(string $token, array $data, Profile $parent = null)
|
||||
protected function createProfileFromData(string $token, array $data, ?Profile $parent = null)
|
||||
{
|
||||
$profile = new Profile($token);
|
||||
$profile->setIp($data['ip']);
|
||||
@@ -300,7 +300,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
return $profile;
|
||||
}
|
||||
|
||||
private function doRead($token, Profile $profile = null): ?Profile
|
||||
private function doRead($token, ?Profile $profile = null): ?Profile
|
||||
{
|
||||
if (!$token || !file_exists($file = $this->getFilename($token))) {
|
||||
return null;
|
||||
@@ -334,7 +334,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
}
|
||||
|
||||
while ($line = fgets($handle)) {
|
||||
$values = str_getcsv($line);
|
||||
$values = str_getcsv($line, ',', '"', '\\');
|
||||
|
||||
if (7 > \count($values)) {
|
||||
// skip invalid lines
|
||||
|
||||
@@ -37,7 +37,7 @@ class Profiler implements ResetInterface
|
||||
private bool $initiallyEnabled = true;
|
||||
private bool $enabled = true;
|
||||
|
||||
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, bool $enable = true)
|
||||
public function __construct(ProfilerStorageInterface $storage, ?LoggerInterface $logger = null, bool $enable = true)
|
||||
{
|
||||
$this->storage = $storage;
|
||||
$this->logger = $logger;
|
||||
@@ -128,7 +128,7 @@ class Profiler implements ResetInterface
|
||||
*
|
||||
* @see https://php.net/datetime.formats for the supported date/time formats
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?string $start, ?string $end, string $statusCode = null/* , \Closure $filter = null */): array
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?string $start, ?string $end, ?string $statusCode = null/* , \Closure $filter = null */): array
|
||||
{
|
||||
$filter = 7 < \func_num_args() ? func_get_arg(7) : null;
|
||||
|
||||
@@ -138,7 +138,7 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Collects data for the given Response.
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): ?Profile
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): ?Profile
|
||||
{
|
||||
if (false === $this->enabled) {
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ interface ProfilerStorageInterface
|
||||
* @param string|null $statusCode The response status code
|
||||
* @param \Closure|null $filter A filter to apply on the list of tokens
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null/* , string $statusCode = null, \Closure $filter = null */): array;
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null/* , string $statusCode = null, \Closure $filter = null */): array;
|
||||
|
||||
/**
|
||||
* Reads data associated with the given token.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="ltr" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="robots" content="noindex,nofollow,noarchive,nosnippet,noodp,notranslate,noimageindex">
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="robots" content="noindex,nofollow,noarchive,nosnippet,noodp,notranslate,noimageindex" />
|
||||
<title>Welcome to Symfony!</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>👋</text></svg>">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>👋</text></svg>" />
|
||||
<style>
|
||||
<?php $hue = random_int(0, 360); ?>
|
||||
<?php $darkColor = static fn (float $alpha = 1) => "hsla($hue, 20%, 45%, $alpha)"; ?>
|
||||
|
||||
3
vendor/symfony/http-kernel/composer.json
vendored
3
vendor/symfony/http-kernel/composer.json
vendored
@@ -38,12 +38,13 @@
|
||||
"symfony/process": "^5.4|^6.0|^7.0",
|
||||
"symfony/property-access": "^5.4.5|^6.0.5|^7.0",
|
||||
"symfony/routing": "^5.4|^6.0|^7.0",
|
||||
"symfony/serializer": "^6.3|^7.0",
|
||||
"symfony/serializer": "^6.4.4|^7.0.4",
|
||||
"symfony/stopwatch": "^5.4|^6.0|^7.0",
|
||||
"symfony/translation": "^5.4|^6.0|^7.0",
|
||||
"symfony/translation-contracts": "^2.5|^3",
|
||||
"symfony/uid": "^5.4|^6.0|^7.0",
|
||||
"symfony/validator": "^6.4|^7.0",
|
||||
"symfony/var-dumper": "^5.4|^6.4|^7.0",
|
||||
"symfony/var-exporter": "^6.2|^7.0",
|
||||
"psr/cache": "^1.0|^2.0|^3.0",
|
||||
"twig/twig": "^2.13|^3.0.4"
|
||||
|
||||
Reference in New Issue
Block a user