update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
-3
View File
@@ -21,7 +21,4 @@ namespace Symfony\Component\HttpKernel\Attribute;
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_FUNCTION)]
class AsController
{
public function __construct()
{
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ final class WithLogLevel
public function __construct(public readonly string $level)
{
if (!\defined('Psr\Log\LogLevel::'.strtoupper($this->level))) {
throw new \InvalidArgumentException(sprintf('Invalid log level "%s".', $this->level));
throw new \InvalidArgumentException(\sprintf('Invalid log level "%s".', $this->level));
}
}
}
+2 -2
View File
@@ -67,7 +67,7 @@ abstract class Bundle implements BundleInterface
if (null !== $extension) {
if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
throw new \LogicException(\sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
}
// check naming convention
@@ -75,7 +75,7 @@ abstract class Bundle implements BundleInterface
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
throw new \LogicException(\sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
}
$this->extension = $extension;
+7
View File
@@ -1,6 +1,13 @@
CHANGELOG
=========
7.2
---
* Remove `@internal` flag and add `@final` to `ServicesResetter`
* Add support for `SYMFONY_DISABLE_RESOURCE_TRACKING` env var
* Add support for configuring trusted proxies/headers/hosts via env vars
7.1
---
@@ -39,7 +39,7 @@ class Psr6CacheClearer implements CacheClearerInterface
public function getPool(string $name): CacheItemPoolInterface
{
if (!$this->hasPool($name)) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name];
@@ -51,7 +51,7 @@ class Psr6CacheClearer implements CacheClearerInterface
public function clearPool(string $name): bool
{
if (!isset($this->pools[$name])) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name]->clear();
+1 -1
View File
@@ -27,6 +27,6 @@ abstract class CacheWarmer implements CacheWarmerInterface
return;
}
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $file));
}
}
@@ -93,15 +93,15 @@ class CacheWarmerAggregate implements CacheWarmerInterface
}
$start = microtime(true);
foreach ((array) $warmer->warmUp($cacheDir, $buildDir) as $item) {
foreach ($warmer->warmUp($cacheDir, $buildDir) as $item) {
if (is_dir($item) || (str_starts_with($item, \dirname($cacheDir)) && !is_file($item)) || ($buildDir && str_starts_with($item, \dirname($buildDir)) && !is_file($item))) {
throw new \LogicException(sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
throw new \LogicException(\sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
}
$preload[] = $item;
}
if ($io?->isDebug()) {
$io->info(sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
$io->info(\sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
}
}
} finally {
+8 -7
View File
@@ -34,16 +34,17 @@ final class ArgumentResolver implements ArgumentResolverInterface
{
private ArgumentMetadataFactoryInterface $argumentMetadataFactory;
private iterable $argumentValueResolvers;
private ?ContainerInterface $namedResolvers;
/**
* @param iterable<mixed, ValueResolverInterface> $argumentValueResolvers
*/
public function __construct(?ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [], ?ContainerInterface $namedResolvers = null)
{
public function __construct(
?ArgumentMetadataFactoryInterface $argumentMetadataFactory = null,
iterable $argumentValueResolvers = [],
private ?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
@@ -60,7 +61,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
if ($attribute->disabled) {
$disabledResolvers[$attribute->resolver] = true;
} elseif ($resolverName) {
throw new \LogicException(sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $metadata->getControllerName()));
throw new \LogicException(\sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $metadata->getControllerName()));
} else {
$resolverName = $attribute->resolver;
}
@@ -96,7 +97,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
}
if (1 < $count && !$metadata->isVariadic()) {
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
throw new \InvalidArgumentException(\sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
}
if ($count) {
@@ -118,7 +119,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
}
}
throw new \RuntimeException(sprintf('Controller "%s" requires the "$%s" argument that could not be resolved. '.($reasonCounter > 1 ? 'Possible reasons: ' : '').'%s', $metadata->getControllerName(), $metadata->getName(), implode(' ', $reasons)));
throw new \RuntimeException(\sprintf('Controller "%s" requires the "$%s" argument that could not be resolved. '.($reasonCounter > 1 ? 'Possible reasons: ' : '').'%s', $metadata->getControllerName(), $metadata->getName(), implode(' ', $reasons)));
}
return $arguments;
@@ -53,7 +53,7 @@ final class BackedEnumValueResolver implements ValueResolverInterface
}
if (!\is_int($value) && !\is_string($value)) {
throw new \LogicException(sprintf('Could not resolve the "%s $%s" controller argument: expecting an int or string, got "%s".', $argument->getType(), $argument->getName(), get_debug_type($value)));
throw new \LogicException(\sprintf('Could not resolve the "%s $%s" controller argument: expecting an int or string, got "%s".', $argument->getType(), $argument->getName(), get_debug_type($value)));
}
/** @var class-string<\BackedEnum> $enumType */
@@ -62,7 +62,7 @@ final class BackedEnumValueResolver implements ValueResolverInterface
try {
return [$enumType::from($value)];
} catch (\ValueError|\TypeError $e) {
throw new NotFoundHttpException(sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
throw new NotFoundHttpException(\sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
}
}
}
@@ -79,7 +79,7 @@ final class DateTimeValueResolver implements ValueResolverInterface
}
if (!$date) {
throw new NotFoundHttpException(sprintf('Invalid date given for parameter "%s".', $argument->getName()));
throw new NotFoundHttpException(\sprintf('Invalid date given for parameter "%s".', $argument->getName()));
}
return [$date];
@@ -53,8 +53,8 @@ final class NotTaggedControllerValueResolver implements ValueResolverInterface
return [];
}
$what = sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$message = sprintf('Could not resolve %s, maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?', $what);
$what = \sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$message = \sprintf('Could not resolve %s, maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?', $what);
throw new RuntimeException($message);
}
@@ -41,7 +41,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
return [];
}
throw HttpException::fromStatusCode($validationFailedCode, sprintf('Missing query parameter "%s".', $name));
throw HttpException::fromStatusCode($validationFailedCode, \sprintf('Missing query parameter "%s".', $name));
}
$value = $request->query->all()[$name];
@@ -55,7 +55,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
$filtered = array_values(array_filter((array) $value, \is_array(...)));
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw HttpException::fromStatusCode($validationFailedCode, sprintf('Invalid query parameter "%s".', $name));
throw HttpException::fromStatusCode($validationFailedCode, \sprintf('Invalid query parameter "%s".', $name));
}
return $filtered;
@@ -83,7 +83,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
default => match ($enumType = is_subclass_of($type, \BackedEnum::class) ? (new \ReflectionEnum($type))->getBackingType()->getName() : null) {
'int' => \FILTER_VALIDATE_INT,
'string' => \FILTER_DEFAULT,
default => throw new \LogicException(sprintf('#[MapQueryParameter] cannot be used on controller argument "%s$%s" of type "%s"; one of array, string, int, float, bool or \BackedEnum should be used.', $argument->isVariadic() ? '...' : '', $argument->getName(), $type ?? 'mixed')),
default => throw new \LogicException(\sprintf('#[MapQueryParameter] cannot be used on controller argument "%s$%s" of type "%s"; one of array, string, int, float, bool or \BackedEnum should be used.', $argument->isVariadic() ? '...' : '', $argument->getName(), $type ?? 'mixed')),
},
};
@@ -106,7 +106,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
}
if (null === $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw HttpException::fromStatusCode($validationFailedCode, sprintf('Invalid query parameter "%s".', $name));
throw HttpException::fromStatusCode($validationFailedCode, \sprintf('Invalid query parameter "%s".', $name));
}
if (!\is_array($value)) {
@@ -120,7 +120,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
}
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw HttpException::fromStatusCode($validationFailedCode, sprintf('Invalid query parameter "%s".', $name));
throw HttpException::fromStatusCode($validationFailedCode, \sprintf('Invalid query parameter "%s".', $name));
}
return $argument->isVariadic() ? $filtered : [$filtered];
@@ -65,6 +65,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
private readonly SerializerInterface&DenormalizerInterface $serializer,
private readonly ?ValidatorInterface $validator = null,
private readonly ?TranslatorInterface $translator = null,
private string $translationDomain = 'validators',
) {
}
@@ -80,16 +81,16 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
}
if (!$attribute instanceof MapUploadedFile && $argument->isVariadic()) {
throw new \LogicException(sprintf('Mapping variadic argument "$%s" is not supported.', $argument->getName()));
throw new \LogicException(\sprintf('Mapping variadic argument "$%s" is not supported.', $argument->getName()));
}
if ($attribute instanceof MapRequestPayload) {
if ('array' === $argument->getType()) {
if (!$attribute->type) {
throw new NearMissValueResolverException(sprintf('Please set the $type argument of the #[%s] attribute to the type of the objects in the expected array.', MapRequestPayload::class));
throw new NearMissValueResolverException(\sprintf('Please set the $type argument of the #[%s] attribute to the type of the objects in the expected array.', MapRequestPayload::class));
}
} elseif ($attribute->type) {
throw new NearMissValueResolverException(sprintf('Please set its type to "array" when using argument $type of #[%s].', MapRequestPayload::class));
throw new NearMissValueResolverException(\sprintf('Please set its type to "array" when using argument $type of #[%s].', MapRequestPayload::class));
}
}
@@ -118,7 +119,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
$request = $event->getRequest();
if (!$argument->metadata->getType()) {
throw new \LogicException(sprintf('Could not resolve the "$%s" controller argument: argument should be typed.', $argument->metadata->getName()));
throw new \LogicException(\sprintf('Could not resolve the "$%s" controller argument: argument should be typed.', $argument->metadata->getName()));
}
if ($this->validator) {
@@ -137,7 +138,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
if ($error->canUseMessageForUser()) {
$parameters['hint'] = $error->getMessage();
}
$message = $trans($template, $parameters, 'validators');
$message = $trans($template, $parameters, $this->translationDomain);
$violations->add(new ConstraintViolation($message, $template, $parameters, null, $error->getPath(), null));
}
$payload = $e->getData();
@@ -185,7 +186,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
private function mapQueryString(Request $request, ArgumentMetadata $argument, MapQueryString $attribute): ?object
{
if (!$data = $request->query->all()) {
if (!($data = $request->query->all()) && ($argument->isNullable() || $argument->hasDefaultValue())) {
return null;
}
@@ -199,7 +200,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
}
if ($attribute->acceptFormat && !\in_array($format, (array) $attribute->acceptFormat, true)) {
throw new UnsupportedMediaTypeHttpException(sprintf('Unsupported format, expects "%s", but "%s" given.', implode('", "', (array) $attribute->acceptFormat), $format));
throw new UnsupportedMediaTypeHttpException(\sprintf('Unsupported format, expects "%s", but "%s" given.', implode('", "', (array) $attribute->acceptFormat), $format));
}
if ('array' === $argument->getType() && null !== $attribute->type) {
@@ -212,7 +213,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
return $this->serializer->denormalize($data, $type, null, $attribute->serializationContext + self::CONTEXT_DENORMALIZE + ('form' === $format ? ['filter_bool' => true] : []));
}
if ('' === $data = $request->getContent()) {
if ('' === ($data = $request->getContent()) && ($argument->isNullable() || $argument->hasDefaultValue())) {
return null;
}
@@ -223,11 +224,11 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
try {
return $this->serializer->deserialize($data, $type, $format, self::CONTEXT_DESERIALIZE + $attribute->serializationContext);
} catch (UnsupportedFormatException $e) {
throw new UnsupportedMediaTypeHttpException(sprintf('Unsupported format: "%s".', $format), $e);
throw new UnsupportedMediaTypeHttpException(\sprintf('Unsupported format: "%s".', $format), $e);
} catch (NotEncodableValueException $e) {
throw new BadRequestHttpException(sprintf('Request payload contains invalid "%s" data.', $format), $e);
throw new BadRequestHttpException(\sprintf('Request payload contains invalid "%s" data.', $format), $e);
} catch (UnexpectedPropertyException $e) {
throw new BadRequestHttpException(sprintf('Request payload contains invalid "%s" property.', $e->property), $e);
throw new BadRequestHttpException(\sprintf('Request payload contains invalid "%s" property.', $e->property), $e);
}
}
@@ -30,7 +30,7 @@ final class RequestValueResolver implements ValueResolverInterface
}
if (str_ends_with($argument->getType() ?? '', '\\Request')) {
throw new NearMissValueResolverException(sprintf('Looks like you required a Request object with the wrong class name "%s". Did you mean to use "%s" instead?', $argument->getType(), Request::class));
throw new NearMissValueResolverException(\sprintf('Looks like you required a Request object with the wrong class name "%s". Did you mean to use "%s" instead?', $argument->getType(), Request::class));
}
return [];
@@ -56,12 +56,12 @@ final class ServiceValueResolver implements ValueResolverInterface
return [$this->container->get($controller)->get($argument->getName())];
} catch (RuntimeException $e) {
$what = 'argument $'.$argument->getName();
$message = str_replace(sprintf('service "%s"', $argument->getName()), $what, $e->getMessage());
$what .= sprintf(' of "%s()"', $controller);
$message = str_replace(\sprintf('service "%s"', $argument->getName()), $what, $e->getMessage());
$what .= \sprintf(' of "%s()"', $controller);
$message = preg_replace('/service "\.service_locator\.[^"]++"/', $what, $message);
if ($e->getMessage() === $message) {
$message = sprintf('Cannot resolve %s: %s', $what, $message);
$message = \sprintf('Cannot resolve %s: %s', $what, $message);
}
throw new NearMissValueResolverException($message, $e->getCode(), $e);
@@ -32,7 +32,7 @@ final class UidValueResolver implements ValueResolverInterface
try {
return [$uidClass::fromString($value)];
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException(sprintf('The uid for the "%s" parameter is invalid.', $argument->getName()), $e);
throw new NotFoundHttpException(\sprintf('The uid for the "%s" parameter is invalid.', $argument->getName()), $e);
}
}
}
@@ -31,7 +31,7 @@ final class VariadicValueResolver implements ValueResolverInterface
$values = $request->attributes->get($argument->getName());
if (!\is_array($values)) {
throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), get_debug_type($values)));
throw new \InvalidArgumentException(\sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), get_debug_type($values)));
}
return $values;
@@ -46,16 +46,16 @@ class ContainerControllerResolver extends ControllerResolver
$this->throwExceptionIfControllerWasRemoved($class, $e);
if ($e instanceof \ArgumentCountError) {
throw new \InvalidArgumentException(sprintf('Controller "%s" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?', $class), 0, $e);
throw new \InvalidArgumentException(\sprintf('Controller "%s" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?', $class), 0, $e);
}
throw new \InvalidArgumentException(sprintf('Controller "%s" does neither exist as service nor as class.', $class), 0, $e);
throw new \InvalidArgumentException(\sprintf('Controller "%s" does neither exist as service nor as class.', $class), 0, $e);
}
private function throwExceptionIfControllerWasRemoved(string $controller, \Throwable $previous): void
{
if ($this->container instanceof Container && isset($this->container->getRemovedIds()[$controller])) {
throw new \InvalidArgumentException(sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous);
throw new \InvalidArgumentException(\sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous);
}
}
}
+14 -14
View File
@@ -73,7 +73,7 @@ class ControllerResolver implements ControllerResolverInterface
}
if (!\is_callable($controller)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
}
return $this->checkController($request, $controller);
@@ -81,7 +81,7 @@ class ControllerResolver implements ControllerResolverInterface
if (\is_object($controller)) {
if (!\is_callable($controller)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
}
return $this->checkController($request, $controller);
@@ -94,11 +94,11 @@ class ControllerResolver implements ControllerResolverInterface
try {
$callable = $this->createController($controller);
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$e->getMessage(), 0, $e);
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$e->getMessage(), 0, $e);
}
if (!\is_callable($callable)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($callable));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($callable));
}
return $this->checkController($request, $callable);
@@ -158,19 +158,19 @@ class ControllerResolver implements ControllerResolverInterface
if (str_contains($callable, '::')) {
$callable = explode('::', $callable, 2);
} else {
return sprintf('Function "%s" does not exist.', $callable);
return \sprintf('Function "%s" does not exist.', $callable);
}
}
if (\is_object($callable)) {
$availableMethods = $this->getClassMethodsWithoutMagicMethods($callable);
$alternativeMsg = $availableMethods ? sprintf(' or use one of the available methods: "%s"', implode('", "', $availableMethods)) : '';
$alternativeMsg = $availableMethods ? \sprintf(' or use one of the available methods: "%s"', implode('", "', $availableMethods)) : '';
return sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', get_debug_type($callable), $alternativeMsg);
return \sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', get_debug_type($callable), $alternativeMsg);
}
if (!\is_array($callable)) {
return sprintf('Invalid type for controller given, expected string, array or object, got "%s".', get_debug_type($callable));
return \sprintf('Invalid type for controller given, expected string, array or object, got "%s".', get_debug_type($callable));
}
if (!isset($callable[0]) || !isset($callable[1]) || 2 !== \count($callable)) {
@@ -180,13 +180,13 @@ class ControllerResolver implements ControllerResolverInterface
[$controller, $method] = $callable;
if (\is_string($controller) && !class_exists($controller)) {
return sprintf('Class "%s" does not exist.', $controller);
return \sprintf('Class "%s" does not exist.', $controller);
}
$className = \is_object($controller) ? get_debug_type($controller) : $controller;
if (method_exists($controller, $method)) {
return sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className);
return \sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className);
}
$collection = $this->getClassMethodsWithoutMagicMethods($controller);
@@ -203,12 +203,12 @@ class ControllerResolver implements ControllerResolverInterface
asort($alternatives);
$message = sprintf('Expected method "%s" on class "%s"', $method, $className);
$message = \sprintf('Expected method "%s" on class "%s"', $method, $className);
if (\count($alternatives) > 0) {
$message .= sprintf(', did you mean "%s"?', implode('", "', $alternatives));
$message .= \sprintf(', did you mean "%s"?', implode('", "', $alternatives));
} else {
$message .= sprintf('. Available methods: "%s".', implode('", "', $collection));
$message .= \sprintf('. Available methods: "%s".', implode('", "', $collection));
}
return $message;
@@ -267,6 +267,6 @@ class ControllerResolver implements ControllerResolverInterface
$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);
}
throw new BadRequestException(sprintf('Callable "%s()" is not allowed as a controller. Did you miss tagging it with "#[AsController]" or registering its type with "%s::allowControllers()"?', $name, self::class));
throw new BadRequestException(\sprintf('Callable "%s()" is not allowed as a controller. Did you miss tagging it with "#[AsController]" or registering its type with "%s::allowControllers()"?', $name, self::class));
}
}
@@ -88,7 +88,7 @@ class ArgumentMetadata
public function getDefaultValue(): mixed
{
if (!$this->hasDefaultValue) {
throw new \LogicException(sprintf('Argument $%s does not have a default value. Use "%s::hasDefaultValue()" to avoid this exception.', $this->name, __CLASS__));
throw new \LogicException(\sprintf('Argument $%s does not have a default value. Use "%s::hasDefaultValue()" to avoid this exception.', $this->name, __CLASS__));
}
return $this->defaultValue;
@@ -40,10 +40,12 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
$eom = \DateTimeImmutable::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
$eol = \DateTimeImmutable::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
$xdebugMode = getenv('XDEBUG_MODE') ?: \ini_get('xdebug.mode');
$this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'symfony_version' => Kernel::VERSION,
'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
'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'),
@@ -55,8 +57,11 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
'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'),
'xdebug_status' => \extension_loaded('xdebug') ? ($xdebugMode && $xdebugMode !== 'off' ? 'Enabled (' . $xdebugMode . ')' : 'Not enabled') : 'Not installed',
'apcu_enabled' => \extension_loaded('apcu') && filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOL),
'apcu_status' => \extension_loaded('apcu') ? (filter_var(\ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled') : 'Not installed',
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL),
'zend_opcache_status' => \extension_loaded('Zend OPcache') ? (filter_var(\ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled') : 'Not installed',
'bundles' => [],
'sapi_name' => \PHP_SAPI,
];
@@ -192,6 +197,11 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
return $this->data['xdebug_enabled'];
}
public function getXdebugStatus(): string
{
return $this->data['xdebug_status'];
}
/**
* Returns true if the function xdebug_info is available.
*/
@@ -208,6 +218,11 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
return $this->data['apcu_enabled'];
}
public function getApcuStatus(): string
{
return $this->data['apcu_status'];
}
/**
* Returns true if Zend OPcache is enabled.
*/
@@ -216,6 +231,11 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
return $this->data['zend_opcache_enabled'];
}
public function getZendOpcacheStatus(): string
{
return $this->data['zend_opcache_status'];
}
public function getBundles(): array|Data
{
return $this->data['bundles'];
+1 -3
View File
@@ -57,7 +57,7 @@ abstract class DataCollector implements DataCollectorInterface
*/
protected function getCasters(): array
{
$casters = [
return [
'*' => function ($v, array $a, Stub $s, $isNested) {
if (!$v instanceof Stub) {
$b = $a;
@@ -82,8 +82,6 @@ abstract class DataCollector implements DataCollectorInterface
return $a;
},
] + ReflectionCaster::UNSET_CLOSURE_FILE_INFO;
return $casters;
}
public function __sleep(): array
@@ -121,12 +121,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
) {
if ($response->headers->has('Content-Type') && str_contains($response->headers->get('Content-Type') ?? '', 'html')) {
$dumper = new HtmlDumper('php://output', $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
}
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
foreach ($this->data as $dump) {
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line'], $dump['label'] ?? '');
}
@@ -196,7 +196,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$dumper = new HtmlDumper($data, $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
throw new \InvalidArgumentException(sprintf('Invalid dump format: "%s".', $format));
throw new \InvalidArgumentException(\sprintf('Invalid dump format: "%s".', $format));
}
$dumps = [];
@@ -235,12 +235,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ($this->webMode) {
$dumper = new HtmlDumper('php://output', $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
}
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
foreach ($this->data as $i => $dump) {
$this->data[$i] = null;
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line'], $dump['label'] ?? '');
@@ -263,9 +263,9 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$f = strip_tags($this->style('', $file));
$name = strip_tags($this->style('', $name));
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
$name = \sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
} else {
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
$name = \sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
}
} else {
$name = $this->style('meta', $name);
@@ -191,7 +191,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
$log['priorityName'] = 'DEBUG';
$log['channel'] = null;
$log['scream'] = false;
unset($log['type'], $log['file'], $log['line'], $log['trace'], $log['trace'], $log['count']);
unset($log['type'], $log['file'], $log['line'], $log['trace'], $log['count']);
$logs[] = $log;
}
@@ -415,7 +415,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
array_splice($trace, 0, $traceEndIndex);
// Merge identical backtraces generated by internal call reports
$name = sprintf('%s:%s', $trace[1]['class'] ?? $trace[0]['file'], $trace[0]['line']);
$name = \sprintf('%s:%s', $trace[1]['class'] ?? $trace[0]['file'], $trace[0]['line']);
if (!\array_key_exists($name, $this->sessionUsages)) {
$this->sessionUsages[$name] = [
'name' => $name,
@@ -27,7 +27,7 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
{
switch ($eventName) {
case KernelEvents::REQUEST:
$event->getRequest()->attributes->set('_stopwatch_token', substr(hash('xxh128', uniqid(mt_rand(), true)), 0, 6));
$event->getRequest()->attributes->set('_stopwatch_token', bin2hex(random_bytes(3)));
$this->stopwatch->openSection();
break;
case KernelEvents::VIEW:
@@ -38,10 +38,10 @@ class FragmentRendererPass implements CompilerPassInterface
$class = $container->getParameterBag()->resolveValue($def->getClass());
if (!$r = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
if (!$r->isSubclassOf(FragmentRendererInterface::class)) {
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class));
throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class));
}
foreach ($tags as $tag) {
@@ -70,7 +70,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
$class = $parameterBag->resolveValue($class);
if (!$r = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
$controllerClasses[] = $class;
@@ -95,11 +95,11 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
foreach (['action', 'argument', 'id'] as $k) {
if (!isset($attributes[$k][0])) {
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "controller.service_arguments" %s for service "%s".', $k, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
throw new InvalidArgumentException(\sprintf('Missing "%s" attribute on tag "controller.service_arguments" %s for service "%s".', $k, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
}
}
if (!isset($methods[$action = strtolower($attributes['action'])])) {
throw new InvalidArgumentException(sprintf('Invalid "action" attribute on tag "controller.service_arguments" for service "%s": no public "%s()" method found on class "%s".', $id, $attributes['action'], $class));
throw new InvalidArgumentException(\sprintf('Invalid "action" attribute on tag "controller.service_arguments" for service "%s": no public "%s()" method found on class "%s".', $id, $attributes['action'], $class));
}
[$r, $parameters] = $methods[$action];
$found = false;
@@ -115,7 +115,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
if (!$found) {
throw new InvalidArgumentException(sprintf('Invalid "controller.service_arguments" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $id, $r->name, $attributes['argument'], $class));
throw new InvalidArgumentException(\sprintf('Invalid "controller.service_arguments" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $id, $r->name, $attributes['argument'], $class));
}
}
@@ -137,8 +137,8 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
$target = $arguments[$r->name][$p->name];
if ('?' !== $target[0]) {
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
} elseif ('' === $target = (string) substr($target, 1)) {
throw new InvalidArgumentException(sprintf('A "controller.service_arguments" tag must have non-empty "id" attributes for service "%s".', $id));
} elseif ('' === $target = substr($target, 1)) {
throw new InvalidArgumentException(\sprintf('A "controller.service_arguments" tag must have non-empty "id" attributes for service "%s".', $id));
} elseif ($p->allowsNull() && !$p->isOptional()) {
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
}
@@ -187,7 +187,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
if ($type && !$p->isOptional() && !$p->allowsNull() && !class_exists($type) && !interface_exists($type, false)) {
$message = sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type);
$message = \sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type);
// see if the type-hint lives in the same namespace as the controller
if (0 === strncmp($type, $class, strrpos($class, '\\'))) {
@@ -35,7 +35,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
if (!$argumentLocator->getArgument(0)) {
// remove empty argument locators
$reason = sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller);
$reason = \sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller);
} else {
// any methods listed for call-at-instantiation cannot be actions
$reason = false;
@@ -48,7 +48,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
$controllerDef = $container->getDefinition($id);
foreach ($controllerDef->getMethodCalls() as [$method]) {
if (0 === strcasecmp($action, $method)) {
$reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
$reason = \sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
break;
}
}
@@ -36,7 +36,7 @@ class ResettableServicePass implements CompilerPassInterface
foreach ($tags as $attributes) {
if (!isset($attributes['method'])) {
throw new RuntimeException(sprintf('Tag "kernel.reset" requires the "method" attribute to be set on service "%s".', $id));
throw new RuntimeException(\sprintf('Tag "kernel.reset" requires the "method" attribute to be set on service "%s".', $id));
}
if (!isset($methods[$id])) {
@@ -21,7 +21,7 @@ use Symfony\Contracts\Service\ResetInterface;
* @author Alexander M. Turek <me@derrabus.de>
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
* @final since Symfony 7.2
*/
class ServicesResetter implements ResetInterface
{
+2
View File
@@ -46,6 +46,8 @@ class RequestEvent extends KernelEvent
/**
* Returns whether a response was set.
*
* @psalm-assert-if-true !null $this->getResponse()
*/
public function hasResponse(): bool
{
@@ -93,7 +93,7 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
*/
public function onKernelResponse(ResponseEvent $event): void
{
if (!$event->isMainRequest() || (!$this->container->has('initialized_session') && !$event->getRequest()->hasSession())) {
if (!$event->isMainRequest()) {
return;
}
+2 -2
View File
@@ -69,7 +69,7 @@ class ErrorListener implements EventSubscriberInterface
$e = FlattenException::createFromThrowable($throwable);
$this->logException($throwable, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), basename($e->getFile()), $e->getLine()), $logLevel);
$this->logException($throwable, \sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), basename($e->getFile()), $e->getLine()), $logLevel);
}
public function onKernelException(ExceptionEvent $event): void
@@ -98,7 +98,7 @@ class ErrorListener implements EventSubscriberInterface
} catch (\Exception $e) {
$f = FlattenException::createFromThrowable($e);
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$this->logException($e, \sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$prev = $e;
do {
@@ -140,15 +140,15 @@ class RouterListener implements EventSubscriberInterface
unset($parameters['_route'], $parameters['_controller']);
$request->attributes->set('_route_params', $parameters);
} catch (ResourceNotFoundException $e) {
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getUriForPath($request->getPathInfo()));
$message = \sprintf('No route found for "%s %s"', $request->getMethod(), $request->getUriForPath($request->getPathInfo()));
if ($referer = $request->headers->get('referer')) {
$message .= sprintf(' (from "%s")', $referer);
$message .= \sprintf(' (from "%s")', $referer);
}
throw new NotFoundHttpException($message, $e);
} catch (MethodNotAllowedException $e) {
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getUriForPath($request->getPathInfo()), implode(', ', $e->getAllowedMethods()));
$message = \sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getUriForPath($request->getPathInfo()), implode(', ', $e->getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e);
}
@@ -18,7 +18,7 @@ class ResolverNotFoundException extends \RuntimeException
*/
public function __construct(string $name, array $alternatives = [])
{
$msg = sprintf('You have requested a non-existent resolver "%s".', $name);
$msg = \sprintf('You have requested a non-existent resolver "%s".', $name);
if ($alternatives) {
if (1 === \count($alternatives)) {
$msg .= ' Did you mean this: "';
+2 -2
View File
@@ -71,7 +71,7 @@ class FragmentHandler
}
if (!isset($this->renderers[$renderer])) {
throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
throw new \InvalidArgumentException(\sprintf('The "%s" renderer does not exist.', $renderer));
}
if (!$request = $this->requestStack->getCurrentRequest()) {
@@ -95,7 +95,7 @@ class FragmentHandler
{
if (!$response->isSuccessful()) {
$responseStatusCode = $response->getStatusCode();
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
}
if (!$response instanceof StreamedResponse) {
@@ -79,7 +79,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
if (\is_array($value)) {
$this->checkNonScalar($value);
} elseif (!\is_scalar($value) && null !== $value) {
throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
throw new \LogicException(\sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
}
}
}
@@ -74,7 +74,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
if (\count($attributes) > 0) {
$flags = \ENT_QUOTES | \ENT_SUBSTITUTE;
foreach ($attributes as $attribute => $value) {
$renderedAttributes .= sprintf(
$renderedAttributes .= \sprintf(
' %s="%s"',
htmlspecialchars($attribute, $flags, $this->charset, false),
htmlspecialchars($value, $flags, $this->charset, false)
@@ -82,7 +82,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
}
}
return new Response(sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
return new Response(\sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
}
public function getName(): string
+9 -9
View File
@@ -46,13 +46,13 @@ abstract class AbstractSurrogate implements SurrogateInterface
return false;
}
return str_contains($value, sprintf('%s/1.0', strtoupper($this->getName())));
return str_contains($value, \sprintf('%s/1.0', strtoupper($this->getName())));
}
public function addSurrogateCapability(Request $request): void
{
$current = $request->headers->get('Surrogate-Capability');
$new = sprintf('symfony="%s/1.0"', strtoupper($this->getName()));
$new = \sprintf('symfony="%s/1.0"', strtoupper($this->getName()));
$request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new);
}
@@ -63,7 +63,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
return false;
}
$pattern = sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName()));
$pattern = \sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName()));
return (bool) preg_match($pattern, $control);
}
@@ -76,7 +76,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
$response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
if (!$response->isSuccessful() && Response::HTTP_NOT_MODIFIED !== $response->getStatusCode()) {
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
}
return $response->getContent();
@@ -105,12 +105,12 @@ abstract class AbstractSurrogate implements SurrogateInterface
$value = $response->headers->get('Surrogate-Control');
$upperName = strtoupper($this->getName());
if (sprintf('content="%s/1.0"', $upperName) == $value) {
if (\sprintf('content="%s/1.0"', $upperName) == $value) {
$response->headers->remove('Surrogate-Control');
} elseif (preg_match(sprintf('#,\s*content="%s/1.0"#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#,\s*content="%s/1.0"#', $upperName), '', $value));
} elseif (preg_match(sprintf('#content="%s/1.0",\s*#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
} elseif (preg_match(\sprintf('#,\s*content="%s/1.0"#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(\sprintf('#,\s*content="%s/1.0"#', $upperName), '', $value));
} elseif (preg_match(\sprintf('#content="%s/1.0",\s*#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(\sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
}
}
+3 -3
View File
@@ -41,14 +41,14 @@ class Esi extends AbstractSurrogate
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
{
$html = sprintf('<esi:include src="%s"%s%s />',
$html = \sprintf('<esi:include src="%s"%s%s />',
$uri,
$ignoreErrors ? ' onerror="continue"' : '',
$alt ? sprintf(' alt="%s"', $alt) : ''
$alt ? \sprintf(' alt="%s"', $alt) : ''
);
if ($comment) {
return sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html);
return \sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html);
}
return $html;
+7 -3
View File
@@ -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;
@@ -87,7 +88,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
private ?SurrogateInterface $surrogate = null,
array $options = [],
) {
// needed in case there is a fatal error because the backend is too slow to respond
register_shutdown_function($this->store->cleanup(...));
@@ -149,7 +149,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
{
$log = [];
foreach ($this->traces as $request => $traces) {
$log[] = sprintf('%s: %s', $request, implode(', ', $traces));
$log[] = \sprintf('%s: %s', $request, implode(', ', $traces));
}
return implode('; ', $log);
@@ -705,7 +705,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
$path .= '?'.$qs;
}
return $request->getMethod().' '.$path;
try {
return $request->getMethod().' '.$path;
} catch (SuspiciousOperationException) {
return '_BAD_METHOD_ '.$path;
}
}
/**
+1 -1
View File
@@ -35,7 +35,7 @@ class Ssi extends AbstractSurrogate
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
{
return sprintf('<!--#include virtual="%s" -->', $uri);
return \sprintf('<!--#include virtual="%s" -->', $uri);
}
public function process(Request $request, Response $response): Response
+1 -1
View File
@@ -44,7 +44,7 @@ class Store implements StoreInterface
private array $options = [],
) {
if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
throw new \RuntimeException(\sprintf('Unable to create the store directory (%s).', $this->root));
}
$this->keyCache = new \SplObjectStorage();
$this->options['private_headers'] ??= ['Set-Cookie'];
+3 -3
View File
@@ -51,16 +51,16 @@ class SubRequestHandler
$trustedValues = [];
foreach (array_reverse($request->getClientIps()) as $ip) {
$trustedIps[] = $ip;
$trustedValues[] = sprintf('for="%s"', $ip);
$trustedValues[] = \sprintf('for="%s"', $ip);
}
if ($ip !== $remoteAddr) {
$trustedIps[] = $remoteAddr;
$trustedValues[] = sprintf('for="%s"', $remoteAddr);
$trustedValues[] = \sprintf('for="%s"', $remoteAddr);
}
// set trusted values, reusing as much as possible the global trusted settings
if (Request::HEADER_FORWARDED & $trustedHeaderSet) {
$trustedValues[0] .= sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme());
$trustedValues[0] .= \sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme());
$request->headers->set('Forwarded', $v = implode(', ', $trustedValues));
$request->server->set('HTTP_FORWARDED', $v);
}
+1 -1
View File
@@ -36,7 +36,7 @@ final class HttpClientKernel implements HttpKernelInterface
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__));
throw new \LogicException(\sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
}
$this->client = $client ?? HttpClient::create();
+8 -8
View File
@@ -164,7 +164,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
// load controller
if (false === $controller = $this->resolver->getController($request)) {
throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
throw new NotFoundHttpException(\sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
}
$event = new ControllerEvent($this, $controller, $request, $type);
@@ -190,7 +190,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
if ($event->hasResponse()) {
$response = $event->getResponse();
} else {
$msg = sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
$msg = \sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
// the user may have forgotten to return something
if (null === $response) {
@@ -280,20 +280,20 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
private function varToString(mixed $var): string
{
if (\is_object($var)) {
return sprintf('an object of type %s', $var::class);
return \sprintf('an object of type %s', $var::class);
}
if (\is_array($var)) {
$a = [];
foreach ($var as $k => $v) {
$a[] = sprintf('%s => ...', $k);
$a[] = \sprintf('%s => ...', $k);
}
return sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
return \sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
}
if (\is_resource($var)) {
return sprintf('a resource (%s)', get_resource_type($var));
return \sprintf('a resource (%s)', get_resource_type($var));
}
if (null === $var) {
@@ -309,11 +309,11 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
}
if (\is_string($var)) {
return sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
return \sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
}
if (is_numeric($var)) {
return sprintf('a number (%s)', (string) $var);
return \sprintf('a number (%s)', (string) $var);
}
return (string) $var;
+1 -2
View File
@@ -25,8 +25,7 @@ use Symfony\Component\HttpFoundation\Response;
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @method Request getRequest()
* @method Response getResponse()
* @template-extends AbstractBrowser<Request, Response>
*/
class HttpKernelBrowser extends AbstractBrowser
{
+44 -22
View File
@@ -73,22 +73,22 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
private static array $freshCache = [];
public const VERSION = '7.1.8';
public const VERSION_ID = 70108;
public const VERSION = '7.2.0';
public const VERSION_ID = 70200;
public const MAJOR_VERSION = 7;
public const MINOR_VERSION = 1;
public const RELEASE_VERSION = 8;
public const MINOR_VERSION = 2;
public const RELEASE_VERSION = 0;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '01/2025';
public const END_OF_LIFE = '01/2025';
public const END_OF_MAINTENANCE = '07/2025';
public const END_OF_LIFE = '07/2025';
public function __construct(
protected string $environment,
protected bool $debug,
) {
if (!$environment) {
throw new \InvalidArgumentException(sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
throw new \InvalidArgumentException(\sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
}
}
@@ -201,7 +201,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function getBundle(string $name): BundleInterface
{
if (!isset($this->bundles[$name])) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
throw new \InvalidArgumentException(\sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
}
return $this->bundles[$name];
@@ -210,11 +210,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function locateResource(string $name): string
{
if ('@' !== $name[0]) {
throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name));
throw new \InvalidArgumentException(\sprintf('A resource name must start with @ ("%s" given).', $name));
}
if (str_contains($name, '..')) {
throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name));
throw new \RuntimeException(\sprintf('File name "%s" contains invalid characters (..).', $name));
}
$bundleName = substr($name, 1);
@@ -228,7 +228,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
return $file;
}
throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Unable to find file "%s".', $name));
}
public function getEnvironment(): string
@@ -250,7 +250,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$r = new \ReflectionObject($this);
if (!is_file($dir = $r->getFileName())) {
throw new \LogicException(sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
throw new \LogicException(\sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
}
$dir = $rootDir = \dirname($dir);
@@ -284,7 +284,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
{
trigger_deprecation('symfony/http-kernel', '7.1', 'The "%s()" method is deprecated since Symfony 7.1 and will be removed in 8.0.', __METHOD__);
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', \sprintf('<?php return %s;', var_export($annotatedClasses, true)));
}
public function getStartTime(): float
@@ -339,7 +339,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name));
throw new \LogicException(\sprintf('Trying to register two bundles with the same name "%s".', $name));
}
$this->bundles[$name] = $bundle;
}
@@ -366,7 +366,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$class = str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) {
throw new \InvalidArgumentException(sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
throw new \InvalidArgumentException(\sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
}
return $class;
@@ -392,7 +392,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
{
$class = $this->getContainerClass();
$buildDir = $this->warmupDir ?: $this->getBuildDir();
$cache = new ConfigCache($buildDir.'/'.$class.'.php', $this->debug);
$skip = $_SERVER['SYMFONY_DISABLE_RESOURCE_TRACKING'] ?? '';
$skip = filter_var($skip, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE) ?? explode(',', $skip);
$cache = new ConfigCache($buildDir.'/'.$class.'.php', $this->debug, null, \is_array($skip) && ['*'] !== $skip ? $skip : ($skip ? [] : null));
$cachePath = $cache->getPath();
// Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
@@ -530,7 +533,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$buildDir = $this->container->getParameter('kernel.build_dir');
$cacheDir = $this->container->getParameter('kernel.cache_dir');
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($cacheDir, $buildDir) : [];
$preload = $this instanceof WarmableInterface ? $this->warmUp($cacheDir, $buildDir) : [];
if ($this->container->has('cache_warmer')) {
$cacheWarmer = $this->container->get('cache_warmer');
@@ -539,7 +542,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$cacheWarmer->enableOptionalWarmers();
}
$preload = array_merge($preload, (array) $cacheWarmer->warmUp($cacheDir, $buildDir));
$preload = array_merge($preload, $cacheWarmer->warmUp($cacheDir, $buildDir));
}
if ($preload && file_exists($preloadFile = $buildDir.'/'.$class.'.preload.php')) {
@@ -594,10 +597,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
foreach (['cache' => $this->getCacheDir(), 'build' => $this->warmupDir ?: $this->getBuildDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
}
} elseif (!is_writable($dir)) {
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
}
}
@@ -742,11 +745,30 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$container = $this->container;
if ($container->hasParameter('kernel.trusted_hosts') && $trustedHosts = $container->getParameter('kernel.trusted_hosts')) {
Request::setTrustedHosts($trustedHosts);
Request::setTrustedHosts(\is_array($trustedHosts) ? $trustedHosts : preg_split('/\s*+,\s*+(?![^{]*})/', $trustedHosts));
}
if ($container->hasParameter('kernel.trusted_proxies') && $container->hasParameter('kernel.trusted_headers') && $trustedProxies = $container->getParameter('kernel.trusted_proxies')) {
Request::setTrustedProxies(\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $container->getParameter('kernel.trusted_headers'));
$trustedHeaders = $container->getParameter('kernel.trusted_headers');
if (\is_string($trustedHeaders)) {
$trustedHeaders = array_map('trim', explode(',', $trustedHeaders));
}
if (\is_array($trustedHeaders)) {
$trustedHeaderSet = 0;
foreach ($trustedHeaders as $header) {
if (!\defined($const = Request::class.'::HEADER_'.strtr(strtoupper($header), '-', '_'))) {
throw new \InvalidArgumentException(\sprintf('The trusted header "%s" is not supported.', $header));
}
$trustedHeaderSet |= \constant($const);
}
} else {
$trustedHeaderSet = $trustedHeaders ?? (Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}
Request::setTrustedProxies(\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $trustedHeaderSet);
}
return $container;
+4 -4
View File
@@ -74,13 +74,13 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
}
if (!isset(self::LEVELS[$minLevel])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $minLevel));
throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $minLevel));
}
$this->minLevelIndex = self::LEVELS[$minLevel];
$this->formatter = null !== $formatter ? $formatter(...) : $this->format(...);
if ($output && false === $this->handle = \is_string($output) ? @fopen($output, 'a') : $output) {
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
throw new InvalidArgumentException(\sprintf('Unable to open "%s".', $output));
}
$this->debug = $debug;
}
@@ -93,7 +93,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
public function log($level, $message, array $context = []): void
{
if (!isset(self::LEVELS[$level])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $level));
}
if (self::LEVELS[$level] < $this->minLevelIndex) {
@@ -155,7 +155,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
$message = strtr($message, $replacements);
}
$log = sprintf('[%s] %s', $level, $message);
$log = \sprintf('[%s] %s', $level, $message);
if ($prefixDate) {
$log = date(\DateTimeInterface::RFC3339).' '.$log;
}
@@ -33,12 +33,12 @@ class FileProfilerStorage implements ProfilerStorageInterface
public function __construct(string $dsn)
{
if (!str_starts_with($dsn, 'file:')) {
throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
throw new \RuntimeException(\sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
}
$this->folder = substr($dsn, 5);
if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder));
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $this->folder));
}
}
@@ -137,7 +137,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
// Create directory
$dir = \dirname($file);
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $dir));
}
}
+1 -2
View File
@@ -20,7 +20,6 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
*/
class Profile
{
/**
* @var DataCollectorInterface[]
*/
@@ -207,7 +206,7 @@ class Profile
public function getCollector(string $name): DataCollectorInterface
{
if (!isset($this->collectors[$name])) {
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
}
return $this->collectors[$name];
+2 -2
View File
@@ -133,7 +133,7 @@ class Profiler implements ResetInterface
return null;
}
$profile = new Profile(substr(hash('xxh128', uniqid(mt_rand(), true)), 0, 6));
$profile = new Profile(bin2hex(random_bytes(3)));
$profile->setTime(time());
$profile->setUrl($request->getUri());
$profile->setMethod($request->getMethod());
@@ -221,7 +221,7 @@ class Profiler implements ResetInterface
public function get(string $name): DataCollectorInterface
{
if (!isset($this->collectors[$name])) {
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
}
return $this->collectors[$name];
+76 -64
View File
@@ -1,6 +1,16 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$renderSymfonyLogoSvg = <<<SVG
<svg aria-hidden="true" focusable="false" height="48" width="48" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64.9 64.9"><path fill="currentColor" d="M32.5 0A32.5 32.5 0 0 0 0 32.5a32.5 32.5 0 0 0 32.5 32.4 32.5 32.5 0 0 0 32.4-32.4A32.5 32.5 0 0 0 32.5 0Zm14.1 12c3.3-.1 5.8 1.4 6 3.8 0 1-.6 3-2.6 3-1.5 0-2.6-.9-2.6-2.2 0-.5 0-1 .4-1.5.4-.6.4-.7.4-1 0-.9-1.3-.9-1.7-.9-4.8.2-6.1 6.8-7.2 12.1l-.5 2.8c2.8.4 4.8 0 6-.8 1.5-1-.5-2-.2-3.2a2.3 2.3 0 0 1 2.1-1.8c1.2 0 2 1.2 2 2.5 0 2-2.7 5-8.2 4.8l-2-.1-1 5.7c-.9 4.3-2.1 10.3-6.5 15.4a13.4 13.4 0 0 1-9.4 5.3c-3.2.1-5.4-1.6-5.4-3.9-.1-2.2 1.9-3.4 3.1-3.5 1.8 0 3 1.2 3 2.6 0 1.3-.6 1.6-1 1.9-.3.2-.7.4-.7 1 0 .1.2.6 1 .6 1.3 0 2.2-.7 2.9-1.2 3.1-2.6 4.3-7.1 5.9-15.4l.3-2c.6-2.8 1.2-5.8 2-8.8-2.1-1.6-3.5-3.7-6.4-4.5-2-.6-3.3-.1-4.2 1a3 3 0 0 0 .3 4l1.7 1.9c2 2.3 3.1 4.1 2.7 6.6-.7 3.9-5.3 6.9-10.9 5.2-4.7-1.4-5.6-4.8-5-6.6.5-1.6 1.8-2 3-1.6 1.4.5 2 2 1.5 3.3 0 .2 0 .4-.2.7l-.6 1c-.3 1 1 1.7 2 2 2.1.7 4.2-.4 4.7-2.1.5-1.6-.5-2.7-1-3.1l-2-2.1c-.8-1-2.8-3.9-1.9-7a6.8 6.8 0 0 1 2.4-3.5c2.4-1.8 5-2 7.6-1.3 3.2.9 4.8 3 6.8 4.7a28 28 0 0 1 5.1-9.3c2.2-2.6 5-4.4 8.3-4.5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="48" width="48" viewBox="0 0 64.9 64.9"><path fill="currentColor" d="M32.5 0A32.5 32.5 0 0 0 0 32.5a32.5 32.5 0 0 0 32.5 32.4 32.5 32.5 0 0 0 32.4-32.4A32.5 32.5 0 0 0 32.5 0Zm14.1 12c3.3-.1 5.8 1.4 6 3.8 0 1-.6 3-2.6 3-1.5 0-2.6-.9-2.6-2.2 0-.5 0-1 .4-1.5.4-.6.4-.7.4-1 0-.9-1.3-.9-1.7-.9-4.8.2-6.1 6.8-7.2 12.1l-.5 2.8c2.8.4 4.8 0 6-.8 1.5-1-.5-2-.2-3.2a2.3 2.3 0 0 1 2.1-1.8c1.2 0 2 1.2 2 2.5 0 2-2.7 5-8.2 4.8l-2-.1-1 5.7c-.9 4.3-2.1 10.3-6.5 15.4a13.4 13.4 0 0 1-9.4 5.3c-3.2.1-5.4-1.6-5.4-3.9-.1-2.2 1.9-3.4 3.1-3.5 1.8 0 3 1.2 3 2.6 0 1.3-.6 1.6-1 1.9-.3.2-.7.4-.7 1 0 .1.2.6 1 .6 1.3 0 2.2-.7 2.9-1.2 3.1-2.6 4.3-7.1 5.9-15.4l.3-2c.6-2.8 1.2-5.8 2-8.8-2.1-1.6-3.5-3.7-6.4-4.5-2-.6-3.3-.1-4.2 1a3 3 0 0 0 .3 4l1.7 1.9c2 2.3 3.1 4.1 2.7 6.6-.7 3.9-5.3 6.9-10.9 5.2-4.7-1.4-5.6-4.8-5-6.6.5-1.6 1.8-2 3-1.6 1.4.5 2 2 1.5 3.3 0 .2 0 .4-.2.7l-.6 1c-.3 1 1 1.7 2 2 2.1.7 4.2-.4 4.7-2.1.5-1.6-.5-2.7-1-3.1l-2-2.1c-.8-1-2.8-3.9-1.9-7a6.8 6.8 0 0 1 2.4-3.5c2.4-1.8 5-2 7.6-1.3 3.2.9 4.8 3 6.8 4.7a28 28 0 0 1 5.1-9.3c2.2-2.6 5-4.4 8.3-4.5z"/></svg>
SVG;
// SVG icons from the Tabler Icons project
@@ -8,7 +18,7 @@ SVG;
// https://github.com/tabler/tabler-icons/blob/master/LICENSE
$renderBoxIconSvg = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-box" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-box" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5" />
<path d="M12 12l8 -4.5" />
@@ -18,14 +28,14 @@ $renderBoxIconSvg = <<<SVG
SVG;
$renderFolderIconSvg = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-folder-open" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-folder-open" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2"></path>
</svg>
SVG;
$renderInfoIconSvg = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-info-circle" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-info-circle" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path>
<path d="M12 9h.01"></path>
@@ -34,7 +44,7 @@ $renderInfoIconSvg = <<<SVG
SVG;
$renderNextStepIconSvg = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-square-chevrons-right" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-square-chevrons-right" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M8 9l3 3l-3 3" />
<path d="M13 9l3 3l-3 3" />
@@ -43,7 +53,7 @@ $renderNextStepIconSvg = <<<SVG
SVG;
$renderLearnIconSvg = <<<SVG
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-book" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-book" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"></path>
<path d="M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"></path>
@@ -54,7 +64,7 @@ $renderLearnIconSvg = <<<SVG
SVG;
$renderCommunityIconSvg = <<<SVG
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-users" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-users" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path>
<path d="M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
@@ -64,7 +74,7 @@ $renderCommunityIconSvg = <<<SVG
SVG;
$renderUpdatesIconSvg = <<<SVG
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bell-ringing" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-tabler icon-tabler-bell-ringing" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" />
<path d="M9 17v1a3 3 0 0 0 6 0v-1" />
@@ -74,7 +84,7 @@ $renderUpdatesIconSvg = <<<SVG
SVG;
$renderWavesSvg = <<<SVG
<svg aria-hidden="true" focusable="false" style="pointer-events: none" class="wave" width="100%" height="50px" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1920 75">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" style="pointer-events: none" class="wave" width="100%" height="50px" preserveAspectRatio="none" viewBox="0 0 1920 75">
<defs>
<style>
.a { fill: none; }
@@ -124,7 +134,7 @@ SVG;
:root {
--hue: <?php echo random_int(0, 360); ?>;
--light-color: hsl(var(--hue), 20%, 95%);
--dark-color: hsl(var(--hue), 20%, 45%);
--dark-color: hsl(var(--hue), 20%, 40%);
}
body {
@@ -195,7 +205,7 @@ SVG;
.info code { margin-top: 10px; }
.info .next-step { display: flex; align-items: center; margin: 0 0 45px; padding: 15px; }
.info .next-step svg { display: inline-flex; margin: 0 10px; top: 0; }
main article { display: flex; justify-content: space-between; padding-top: 45px; }
main article nav { display: flex; justify-content: space-between; padding-top: 45px; }
main article section + section { margin-top: 0; }
main h2 { font-size: 21px; }
main h2 svg { height: 36px; width: 36px; margin-right: 15px; }
@@ -251,7 +261,7 @@ SVG;
</li>
</ul>
<p class="next-step">
<p class="next-step" role="note">
<strong>Next Step</strong>
<?php echo $renderNextStepIconSvg; ?>
<span>
@@ -262,7 +272,7 @@ SVG;
</section>
</div>
<section class="waves">
<section class="waves" aria-hidden="true" role="separator">
<?php echo $renderWavesSvg; ?>
</section>
</header>
@@ -270,59 +280,61 @@ SVG;
<main>
<div class="wrapper">
<article>
<section>
<h2>
<span><?php echo $renderLearnIconSvg; ?></span>
Learn
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/doc/<?php echo $docVersion; ?>">Read Symfony Docs</a>
</li>
<li>
<a target="_blank" href="https://symfonycasts.com/screencast/symfony">Watch Symfony Screencast</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/book">Read Symfony Book</a>
</li>
</ul>
</section>
<nav>
<section>
<h2>
<span><?php echo $renderLearnIconSvg; ?></span>
Learn
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/doc/<?php echo $docVersion; ?>">Read Symfony Docs</a>
</li>
<li>
<a target="_blank" href="https://symfonycasts.com/screencast/symfony">Watch Symfony Screencast</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/book">Read Symfony Book</a>
</li>
</ul>
</section>
<section>
<h2>
<span><?php echo $renderCommunityIconSvg; ?></span>
Community & Support
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/support">Symfony Support</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/community">Join the Symfony Community</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/doc/current/contributing/index.html">Contribute to Symfony</a>
</li>
</ul>
</section>
<section>
<h2>
<span><?php echo $renderCommunityIconSvg; ?></span>
Community & Support
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/support">Symfony Support</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/community">Join the Symfony Community</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/doc/current/contributing/index.html">Contribute to Symfony</a>
</li>
</ul>
</section>
<section>
<h2>
<span><?php echo $renderUpdatesIconSvg; ?></span>
Stay Updated
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/blog/">Symfony Blog</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/community#interact">Follow Symfony</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/events/">Attend Symfony Events</a>
</li>
</ul>
</section>
<section>
<h2>
<span><?php echo $renderUpdatesIconSvg; ?></span>
Stay Updated
</h2>
<ul>
<li>
<a target="_blank" href="https://symfony.com/blog/">Symfony Blog</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/community#interact">Follow Symfony</a>
</li>
<li>
<a target="_blank" href="https://symfony.com/events/">Attend Symfony Events</a>
</li>
</ul>
</section>
</nav>
</article>
</div>
</main>
+2 -2
View File
@@ -47,7 +47,7 @@
"symfony/var-dumper": "^6.4|^7.0",
"symfony/var-exporter": "^6.4|^7.0",
"psr/cache": "^1.0|^2.0|^3.0",
"twig/twig": "^3.0.4"
"twig/twig": "^3.12"
},
"provide": {
"psr/log-implementation": "1.0|2.0|3.0"
@@ -69,7 +69,7 @@
"symfony/twig-bridge": "<6.4",
"symfony/validator": "<6.4",
"symfony/var-dumper": "<6.4",
"twig/twig": "<3.0.4"
"twig/twig": "<3.12"
},
"autoload": {
"psr-4": { "Symfony\\Component\\HttpKernel\\": "" },