Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private function getTagVersions(array $tagsByKey, bool $persistTags): array
(self::$saveTags)($this->tags, $newTags);
}

while ($now > ($this->knownTagVersions[$tag = array_key_first($this->knownTagVersions)][0] ?? \INF)) {
while ($now > ($this->knownTagVersions[$tag = array_key_first($this->knownTagVersions) ?? ''][0] ?? \INF)) {
unset($this->knownTagVersions[$tag]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function normalizeKeys(bool $bool): static

public function append(NodeDefinition $node): static
{
$this->children[$node->name] = $node->setParent($this);
$this->children[$node->name ?? ''] = $node->setParent($this);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Input/ArgvInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function parseArgument(string $token): void
} else {
$all = $this->definition->getArguments();
$symfonyCommandName = null;
if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
if (($inputArgument = $all[$key = array_key_first($all) ?? ''] ?? null) && 'command' === $inputArgument->getName()) {
$symfonyCommandName = $this->arguments['command'] ?? null;
unset($all[$key]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct(bool $autoload = false, array $skippedIds = [])

protected function processValue(mixed $value, bool $isRoot = false): mixed
{
if (isset($this->skippedIds[$this->currentId])) {
if (isset($this->skippedIds[$this->currentId ?? ''])) {
return $value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()
|| ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()
) {
$this->sourceReferences[$targetId][$this->currentId] ??= true;
$this->sourceReferences[$targetId][$this->currentId ?? ''] ??= true;
} else {
$this->sourceReferences[$targetId][$this->currentId] = false;
$this->sourceReferences[$targetId][$this->currentId ?? ''] = false;
}

return $value;
Expand All @@ -81,7 +81,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
return parent::processValue($value, $isRoot);
}

$this->erroredDefinitions[$this->currentId] = $value;
$this->erroredDefinitions[$this->currentId ?? ''] = $value;

return parent::processValue($value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed

$this->container->log($this, \sprintf('Inlined service "%s" to "%s".', $id, $this->currentId));
$this->inlinedIds[$id] = $definition->isPublic() || !$definition->isShared();
$this->notInlinedIds[$this->currentId] = true;
$this->notInlinedIds[$this->currentId ?? ''] = true;

if ($definition->isShared()) {
return $definition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
foreach ($bindings as $key => $binding) {
[$bindingValue, $bindingId, $used, $bindingType, $file] = $binding->getValues();
if ($used) {
$this->usedBindings[$bindingId] = true;
unset($this->unusedBindings[$bindingId]);
} elseif (!isset($this->usedBindings[$bindingId])) {
$this->unusedBindings[$bindingId] = [$key, $this->currentId, $bindingType, $file];
$this->usedBindings[$bindingId ?? ''] = true;
unset($this->unusedBindings[$bindingId ?? '']);
} elseif (!isset($this->usedBindings[$bindingId ?? ''])) {
$this->unusedBindings[$bindingId ?? ''] = [$key, $this->currentId, $bindingType, $file];
}

if (preg_match('/^(?:(?:array|bool|float|int|string|iterable|([^ $]++)) )\$/', $key, $m)) {
Expand Down Expand Up @@ -263,8 +263,8 @@ private function getBindingValue(BoundArgument $binding): mixed
{
[$bindingValue, $bindingId] = $binding->getValues();

$this->usedBindings[$bindingId] = true;
unset($this->unusedBindings[$bindingId]);
$this->usedBindings[$bindingId ?? ''] = true;
unset($this->unusedBindings[$bindingId ?? '']);

return $bindingValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
return $value->clearTag('container.hot_path');
}

$this->resolvedIds[$this->currentId] = true;
$this->resolvedIds[$this->currentId ?? ''] = true;

if (!$value->hasTag('container.hot_path')) {
return $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function registerExtension(ExtensionInterface $extension)
$this->extensions[$extension->getAlias()] = $extension;

if (false !== $extension->getNamespace()) {
$this->extensionsByNs[$extension->getNamespace()] = $extension;
$this->extensionsByNs[$extension->getNamespace() ?? ''] = $extension;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct(array $mapping)

public function transform($value): mixed
{
$value ??= '';
if (!\array_key_exists($value, $this->mapping)) {
throw new TransformationFailedException(sprintf('No mapping for value "%s"', $value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function preSetData(FormEvent $event)
{
$data = $event->getData();

if (isset($this->mapping['preSetData'][$data])) {
$event->setData($this->mapping['preSetData'][$data]);
if (isset($this->mapping['preSetData'][$data ?? ''])) {
$event->setData($this->mapping['preSetData'][$data ?? '']);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function getCacheControlDirective(string $key): bool|string|null
*/
public function setCookie(Cookie $cookie)
{
$this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
$this->cookies[$cookie->getDomain() ?? ''][$cookie->getPath()][$cookie->getName()] = $cookie;
$this->headerNames['set-cookie'] = 'Set-Cookie';
}

Expand All @@ -187,13 +187,13 @@ public function removeCookie(string $name, ?string $path = '/', ?string $domain
{
$path ??= '/';

unset($this->cookies[$domain][$path][$name]);
unset($this->cookies[$domain ?? ''][$path][$name]);

if (empty($this->cookies[$domain][$path])) {
unset($this->cookies[$domain][$path]);
if (empty($this->cookies[$domain ?? ''][$path])) {
unset($this->cookies[$domain ?? ''][$path]);

if (empty($this->cookies[$domain])) {
unset($this->cookies[$domain]);
if (empty($this->cookies[$domain ?? ''])) {
unset($this->cookies[$domain ?? '']);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ private function getListener(?string $key): array
}

// Fetch from injected current firewall information, if possible
if (isset($this->listeners[$this->currentFirewallName])) {
return $this->listeners[$this->currentFirewallName];
if (isset($this->listeners[$this->currentFirewallName ?? ''])) {
return $this->listeners[$this->currentFirewallName ?? ''];
}

foreach ($this->listeners as $listener) {
Expand Down
28 changes: 14 additions & 14 deletions src/Symfony/Component/Serializer/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N
$genericType = '*';
}

if (!isset($this->normalizerCache[$format][$type])) {
$this->normalizerCache[$format][$type] = [];
if (!isset($this->normalizerCache[$format ?? ''][$type])) {
$this->normalizerCache[$format ?? ''][$type] = [];

foreach ($this->normalizers as $k => $normalizer) {
if (!$normalizer instanceof NormalizerInterface) {
Expand All @@ -293,9 +293,9 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N
trigger_deprecation('symfony/serializer', '6.3', '"%s" should implement "NormalizerInterface::getSupportedTypes(?string $format): array".', $normalizer::class);

if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
$this->normalizerCache[$format][$type][$k] = false;
$this->normalizerCache[$format ?? ''][$type][$k] = false;
} elseif ($normalizer->supportsNormalization($data, $format, $context)) {
$this->normalizerCache[$format][$type][$k] = true;
$this->normalizerCache[$format ?? ''][$type][$k] = true;
break;
}

Expand All @@ -313,7 +313,7 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N

if (null === $isCacheable) {
unset($supportedTypes['*'], $supportedTypes['object']);
} elseif ($this->normalizerCache[$format][$type][$k] = $isCacheable && $normalizer->supportsNormalization($data, $format, $context)) {
} elseif ($this->normalizerCache[$format ?? ''][$type][$k] = $isCacheable && $normalizer->supportsNormalization($data, $format, $context)) {
break 2;
}

Expand All @@ -324,13 +324,13 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N
continue;
}

if ($this->normalizerCache[$format][$type][$k] ??= $isCacheable && $normalizer->supportsNormalization($data, $format, $context)) {
if ($this->normalizerCache[$format ?? ''][$type][$k] ??= $isCacheable && $normalizer->supportsNormalization($data, $format, $context)) {
break;
}
}
}

foreach ($this->normalizerCache[$format][$type] as $k => $cached) {
foreach ($this->normalizerCache[$format ?? ''][$type] as $k => $cached) {
$normalizer = $this->normalizers[$k];
if ($cached || $normalizer->supportsNormalization($data, $format, $context)) {
return $normalizer;
Expand All @@ -350,8 +350,8 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N
*/
private function getDenormalizer(mixed $data, string $class, ?string $format, array $context): ?DenormalizerInterface
{
if (!isset($this->denormalizerCache[$format][$class])) {
$this->denormalizerCache[$format][$class] = [];
if (!isset($this->denormalizerCache[$format ?? ''][$class])) {
$this->denormalizerCache[$format ?? ''][$class] = [];
$genericType = class_exists($class) || interface_exists($class, false) ? 'object' : '*';

foreach ($this->normalizers as $k => $normalizer) {
Expand All @@ -363,9 +363,9 @@ private function getDenormalizer(mixed $data, string $class, ?string $format, ar
trigger_deprecation('symfony/serializer', '6.3', '"%s" should implement "DenormalizerInterface::getSupportedTypes(?string $format): array".', $normalizer::class);

if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
$this->denormalizerCache[$format][$class][$k] = false;
$this->denormalizerCache[$format ?? ''][$class][$k] = false;
} elseif ($normalizer->supportsDenormalization(null, $class, $format, $context)) {
$this->denormalizerCache[$format][$class][$k] = true;
$this->denormalizerCache[$format ?? ''][$class][$k] = true;
break;
}

Expand All @@ -386,7 +386,7 @@ private function getDenormalizer(mixed $data, string $class, ?string $format, ar

if (null === $isCacheable) {
unset($supportedTypes['*'], $supportedTypes['object']);
} elseif ($this->denormalizerCache[$format][$class][$k] = $isCacheable && $normalizer->supportsDenormalization(null, $class, $format, $context)) {
} elseif ($this->denormalizerCache[$format ?? ''][$class][$k] = $isCacheable && $normalizer->supportsDenormalization(null, $class, $format, $context)) {
break 2;
}

Expand All @@ -397,13 +397,13 @@ private function getDenormalizer(mixed $data, string $class, ?string $format, ar
continue;
}

if ($this->denormalizerCache[$format][$class][$k] ??= $isCacheable && $normalizer->supportsDenormalization(null, $class, $format, $context)) {
if ($this->denormalizerCache[$format ?? ''][$class][$k] ??= $isCacheable && $normalizer->supportsDenormalization(null, $class, $format, $context)) {
break;
}
}
}

foreach ($this->denormalizerCache[$format][$class] as $k => $cached) {
foreach ($this->denormalizerCache[$format ?? ''][$class] as $k => $cached) {
$normalizer = $this->normalizers[$k];
if ($cached || $normalizer->supportsDenormalization($data, $class, $format, $context)) {
return $normalizer;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/String/Slugger/AsciiSlugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public function slug(string $string, string $separator = '-', ?string $locale =

if (\is_array($this->symbolsMap)) {
$map = null;
if (isset($this->symbolsMap[$locale])) {
$map = $this->symbolsMap[$locale];
if (isset($this->symbolsMap[$locale ?? ''])) {
$map = $this->symbolsMap[$locale ?? ''];
} else {
$parent = self::getParentLocale($locale);
if ($parent && isset($this->symbolsMap[$parent])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
$class = $this->definitions[$i]->getClass();

if (ServiceLocator::class === $class) {
if (!isset($this->controllers[$this->currentId])) {
if (!isset($this->controllers[$this->currentId ?? ''])) {
continue;
}
foreach ($this->controllers[$this->currentId] as $class => $_) {
foreach ($this->controllers[$this->currentId ?? ''] as $class => $_) {
$this->paths[$class] = true;
}
} else {
Expand Down
Loading