Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 279bccb

Browse files
minor #44659 Add more nullsafe operators (nicolas-grekas)
This PR was merged into the 6.1 branch. Discussion ---------- Add more nullsafe operators | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 56f908a Add more nullsafe operators
2 parents 5eb8777 + 56f908a commit 279bccb

File tree

101 files changed

+208
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+208
-206
lines changed

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null): void
5656
return;
5757
}
5858

59-
$eventArgs = $eventArgs ?? EventArgs::getEmptyInstance();
59+
$eventArgs ??= EventArgs::getEmptyInstance();
6060

6161
if (!isset($this->initialized[$eventName])) {
6262
$this->initializeListeners($eventName);

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getSession(): ?Session
100100
}
101101
$request = $this->getRequest();
102102

103-
return $request && $request->hasSession() ? $request->getSession() : null;
103+
return $request?->hasSession() ? $request->getSession() : null;
104104
}
105105

106106
/**

src/Symfony/Bundle/SecurityBundle/Debug/TraceableListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getInfo(): array
4545
return [
4646
'response' => $this->response,
4747
'time' => $this->time,
48-
'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener instanceof TraceableAuthenticatorManagerListener ? $this->listener->getAuthenticatorManagerListener() : $this->listener),
48+
'stub' => $this->stub ??= ClassStub::wrapCallable($this->listener instanceof TraceableAuthenticatorManagerListener ? $this->listener->getAuthenticatorManagerListener() : $this->listener),
4949
];
5050
}
5151
}

src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function onKernelResponse(ResponseEvent $event)
9595

9696
$nonces = [];
9797
if ($this->cspHandler) {
98-
if ($this->dumpDataCollector && $this->dumpDataCollector->getDumpsCount() > 0) {
98+
if ($this->dumpDataCollector?->getDumpsCount() > 0) {
9999
$this->cspHandler->disableCsp();
100100
}
101101

src/Symfony/Component/Cache/Adapter/ChainAdapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public function __construct(array $adapters, int $defaultLifetime = 0)
6666
$this->adapterCount = \count($this->adapters);
6767
$this->defaultLifetime = $defaultLifetime;
6868

69-
self::$syncItem ?? self::$syncItem = \Closure::bind(
69+
self::$syncItem ??= \Closure::bind(
7070
static function ($sourceItem, $item, $defaultLifetime, $sourceMetadata = null) {
7171
$sourceItem->isTaggable = false;
72-
$sourceMetadata = $sourceMetadata ?? $sourceItem->metadata;
72+
$sourceMetadata ??= $sourceItem->metadata;
7373
unset($sourceMetadata[CacheItem::METADATA_TAGS]);
7474

7575
$item->value = $sourceItem->value;
@@ -108,7 +108,7 @@ public function get(string $key, callable $callback, float $beta = null, array &
108108
$value = $this->doGet($adapter, $key, $callback, $beta, $metadata);
109109
}
110110
if (null !== $item) {
111-
(self::$syncItem)($lastItem = $lastItem ?? $item, $item, $this->defaultLifetime, $metadata);
111+
(self::$syncItem)($lastItem ??= $item, $item, $this->defaultLifetime, $metadata);
112112
}
113113

114114
return $value;

src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function doFetch(array $ids): iterable
135135

136136
foreach ($missingIds as $k => $id) {
137137
try {
138-
$file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id);
138+
$file = $this->files[$id] ??= $this->getFile($id);
139139

140140
if (isset(self::$valuesCache[$file])) {
141141
[$expiresAt, $this->values[$id]] = self::$valuesCache[$file];
@@ -176,7 +176,7 @@ protected function doHave(string $id): bool
176176

177177
set_error_handler($this->includeHandler);
178178
try {
179-
$file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id);
179+
$file = $this->files[$id] ??= $this->getFile($id);
180180
$getExpiry = true;
181181

182182
if (isset(self::$valuesCache[$file])) {

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
4848
$this->pool = $itemsPool;
4949
$this->tags = $tagsPool ?? $itemsPool;
5050
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
51-
self::$createCacheItem ?? self::$createCacheItem = \Closure::bind(
51+
self::$createCacheItem ??= \Closure::bind(
5252
static function ($key, $value, CacheItem $protoItem) {
5353
$item = new CacheItem();
5454
$item->key = $key;
@@ -61,7 +61,7 @@ static function ($key, $value, CacheItem $protoItem) {
6161
null,
6262
CacheItem::class
6363
);
64-
self::$setCacheItemTags ?? self::$setCacheItemTags = \Closure::bind(
64+
self::$setCacheItemTags ??= \Closure::bind(
6565
static function (CacheItem $item, $key, array &$itemTags) {
6666
$item->isTaggable = true;
6767
if (!$item->isHit) {
@@ -82,7 +82,7 @@ static function (CacheItem $item, $key, array &$itemTags) {
8282
null,
8383
CacheItem::class
8484
);
85-
self::$getTagsByKey ?? self::$getTagsByKey = \Closure::bind(
85+
self::$getTagsByKey ??= \Closure::bind(
8686
static function ($deferred) {
8787
$tagsByKey = [];
8888
foreach ($deferred as $key => $item) {
@@ -95,7 +95,7 @@ static function ($deferred) {
9595
null,
9696
CacheItem::class
9797
);
98-
self::$saveTags ?? self::$saveTags = \Closure::bind(
98+
self::$saveTags ??= \Closure::bind(
9999
static function (AdapterInterface $tagsAdapter, array $tags) {
100100
ksort($tags);
101101

@@ -394,7 +394,7 @@ private function getTagVersions(array $tagsByKey): array
394394
$newVersion = null;
395395
foreach ($this->tags->getItems(array_keys($tags)) as $tag => $version) {
396396
if (!$version->isHit()) {
397-
$newTags[$tag] = $version->set($newVersion ?? $newVersion = random_int(\PHP_INT_MIN, \PHP_INT_MAX));
397+
$newTags[$tag] = $version->set($newVersion ??= random_int(\PHP_INT_MIN, \PHP_INT_MAX));
398398
}
399399
$tagVersions[$tag = $tags[$tag]] = $version->get();
400400
$this->knownTagVersions[$tag] = [$now, $tagVersions[$tag]];

src/Symfony/Component/Cache/LockRegistry.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s
101101
$locked = flock($lock, \LOCK_EX | \LOCK_NB, $wouldBlock);
102102

103103
if ($locked || !$wouldBlock) {
104-
$logger && $logger->info(sprintf('Lock %s, now computing item "{key}"', $locked ? 'acquired' : 'not supported'), ['key' => $item->getKey()]);
104+
$logger?->info(sprintf('Lock %s, now computing item "{key}"', $locked ? 'acquired' : 'not supported'), ['key' => $item->getKey()]);
105105
self::$lockedFiles[$key] = true;
106106

107107
$value = $callback($item, $save);
@@ -118,7 +118,7 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s
118118
return $value;
119119
}
120120
// if we failed the race, retry locking in blocking mode to wait for the winner
121-
$logger && $logger->info('Item "{key}" is locked, waiting for it to be released', ['key' => $item->getKey()]);
121+
$logger?->info('Item "{key}" is locked, waiting for it to be released', ['key' => $item->getKey()]);
122122
flock($lock, \LOCK_SH);
123123
} finally {
124124
flock($lock, \LOCK_UN);
@@ -130,15 +130,15 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s
130130

131131
try {
132132
$value = $pool->get($item->getKey(), $signalingCallback, 0);
133-
$logger && $logger->info('Item "{key}" retrieved after lock was released', ['key' => $item->getKey()]);
133+
$logger?->info('Item "{key}" retrieved after lock was released', ['key' => $item->getKey()]);
134134
$save = false;
135135

136136
return $value;
137137
} catch (\Exception $e) {
138138
if ($signalingException !== $e) {
139139
throw $e;
140140
}
141-
$logger && $logger->info('Item "{key}" not found while lock was released, now retrying', ['key' => $item->getKey()]);
141+
$logger?->info('Item "{key}" not found while lock was released, now retrying', ['key' => $item->getKey()]);
142142
}
143143
}
144144

src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function unmarshall(string $value): mixed
7171
return null;
7272
}
7373
static $igbinaryNull;
74-
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
74+
if ($value === $igbinaryNull ??= \extension_loaded('igbinary') ? igbinary_serialize(null) : false) {
7575
return null;
7676
}
7777
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');

src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __invoke(callable $callback, CacheItem $item, bool &$save, Adapt
3838
{
3939
if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) {
4040
// The item is stale or the callback cannot be reversed: we must compute the value now
41-
$logger && $logger->info('Computing item "{key}" online: '.($item->isHit() ? 'callback cannot be reversed' : 'item is stale'), ['key' => $item->getKey()]);
41+
$logger?->info('Computing item "{key}" online: '.($item->isHit() ? 'callback cannot be reversed' : 'item is stale'), ['key' => $item->getKey()]);
4242

4343
return null !== $this->callbackWrapper ? ($this->callbackWrapper)($callback, $item, $save, $pool, $setMetadata, $logger) : $callback($item, $save);
4444
}

src/Symfony/Component/Cache/Messenger/EarlyExpirationHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __invoke(EarlyExpirationMessage $message)
5959

6060
static $setMetadata;
6161

62-
$setMetadata ?? $setMetadata = \Closure::bind(
62+
$setMetadata ??= \Closure::bind(
6363
function (CacheItem $item, float $startTime) {
6464
if ($item->expiry > $endTime = microtime(true)) {
6565
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $item->expiry;

src/Symfony/Component/Cache/Traits/ContractsTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable
6363

6464
private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null)
6565
{
66-
if (0 > $beta = $beta ?? 1.0) {
66+
if (0 > $beta ??= 1.0) {
6767
throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta));
6868
}
6969

7070
static $setMetadata;
7171

72-
$setMetadata ?? $setMetadata = \Closure::bind(
72+
$setMetadata ??= \Closure::bind(
7373
static function (CacheItem $item, float $startTime, ?array &$metadata) {
7474
if ($item->expiry > $endTime = microtime(true)) {
7575
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry;

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ protected function doDelete(array $ids): bool
441441

442442
if ($this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof ClusterInterface) {
443443
static $del;
444-
$del = $del ?? (class_exists(UNLINK::class) ? 'unlink' : 'del');
444+
$del ??= (class_exists(UNLINK::class) ? 'unlink' : 'del');
445445

446446
$this->pipeline(function () use ($ids, $del) {
447447
foreach ($ids as $id) {
@@ -498,7 +498,7 @@ protected function doSave(array $values, int $lifetime): array|bool
498498
private function pipeline(\Closure $generator, object $redis = null): \Generator
499499
{
500500
$ids = [];
501-
$redis = $redis ?? $this->redis;
501+
$redis ??= $this->redis;
502502

503503
if ($redis instanceof RedisClusterProxy || $redis instanceof \RedisCluster || ($redis instanceof \Predis\ClientInterface && $redis->getConnection() instanceof RedisCluster)) {
504504
// phpredis & predis don't support pipelining with RedisCluster

src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TreeBuilder implements NodeParentInterface
2525

2626
public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
2727
{
28-
$builder = $builder ?? new NodeBuilder();
28+
$builder ??= new NodeBuilder();
2929
$this->root = $builder->node($name, $type)->setParent($this);
3030
}
3131

src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function testSetExtraKeyMethodIsNotGeneratedWhenAllowExtraKeysIsFalse()
148148
*/
149149
private function generateConfigBuilder(string $configurationClass, string $outputDir = null)
150150
{
151-
$outputDir ?? $outputDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
151+
$outputDir ??= sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
152152
if (!str_contains($outputDir, __DIR__)) {
153153
$this->tempDir[] = $outputDir;
154154
}

src/Symfony/Component/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ public function has(string $name): bool
558558
{
559559
$this->init();
560560

561-
return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
561+
return isset($this->commands[$name]) || ($this->commandLoader?->has($name) && $this->add($this->commandLoader->get($name)));
562562
}
563563

564564
/**

src/Symfony/Component/Console/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ public function getHelp(): string
556556
public function getProcessedHelp(): string
557557
{
558558
$name = $this->name;
559-
$isSingleCommand = $this->application && $this->application->isSingleCommand();
559+
$isSingleCommand = $this->application?->isSingleCommand();
560560

561561
$placeholders = [
562562
'%command.name%',

src/Symfony/Component/Console/Completion/CompletionInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function bind(InputDefinition $definition): void
8484
return;
8585
}
8686

87-
if (null !== $option && $option->acceptValue()) {
87+
if ($option?->acceptValue()) {
8888
$this->completionType = self::TYPE_OPTION_VALUE;
8989
$this->completionName = $option->getName();
9090
$this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
@@ -97,7 +97,7 @@ public function bind(InputDefinition $definition): void
9797
if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
9898
// check if previous option accepted a value
9999
$previousOption = $this->getOptionFromToken($previousToken);
100-
if (null !== $previousOption && $previousOption->acceptValue()) {
100+
if ($previousOption?->acceptValue()) {
101101
$this->completionType = self::TYPE_OPTION_VALUE;
102102
$this->completionName = $previousOption->getName();
103103
$this->completionValue = $relevantToken;

src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function process(ContainerBuilder $container)
8787
$lazyCommandMap[$tag['command']] = $id;
8888
}
8989

90-
$description = $description ?? $tag['description'] ?? null;
90+
$description ??= $tag['description'] ?? null;
9191
}
9292

9393
$definition->addMethodCall('setName', [$commandName]);

src/Symfony/Component/Console/Formatter/NullOutputFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function format(?string $message): ?string
3232
public function getStyle(string $name): OutputFormatterStyleInterface
3333
{
3434
// to comply with the interface we must return a OutputFormatterStyleInterface
35-
return $this->style ?? $this->style = new NullOutputFormatterStyle();
35+
return $this->style ??= new NullOutputFormatterStyle();
3636
}
3737

3838
/**

src/Symfony/Component/Console/Helper/Dumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function __construct(OutputInterface $output, CliDumper $dumper = null, C
3434

3535
if (class_exists(CliDumper::class)) {
3636
$this->handler = function ($var): string {
37-
$dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
37+
$dumper = $this->dumper ??= new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
3838
$dumper->setColors($this->output->isDecorated());
3939

40-
return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
40+
return rtrim($dumper->dump(($this->cloner ??= new VarCloner())->cloneVar($var)->withRefHandles(false), true));
4141
};
4242
} else {
4343
$this->handler = function ($var): string {

src/Symfony/Component/Console/Helper/Helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getHelperSet(): ?HelperSet
4545
*/
4646
public static function width(?string $string): int
4747
{
48-
$string ?? $string = '';
48+
$string ??= '';
4949

5050
if (preg_match('//u', $string)) {
5151
return (new UnicodeString($string))->width(false);
@@ -64,7 +64,7 @@ public static function width(?string $string): int
6464
*/
6565
public static function length(?string $string): int
6666
{
67-
$string ?? $string = '';
67+
$string ??= '';
6868

6969
if (preg_match('//u', $string)) {
7070
return (new UnicodeString($string))->length();
@@ -82,7 +82,7 @@ public static function length(?string $string): int
8282
*/
8383
public static function substr(?string $string, int $from, int $length = null): string
8484
{
85-
$string ?? $string = '';
85+
$string ??= '';
8686

8787
if (false === $encoding = mb_detect_encoding($string, null, true)) {
8888
return substr($string, $from, $length);

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ArgvInput extends Input
4545

4646
public function __construct(array $argv = null, InputDefinition $definition = null)
4747
{
48-
$argv = $argv ?? $_SERVER['argv'] ?? [];
48+
$argv ??= $_SERVER['argv'] ?? [];
4949

5050
// strip the application name
5151
array_shift($argv);

src/Symfony/Component/Console/Question/Question.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function setAutocompleterValues(?iterable $values): static
152152
} elseif ($values instanceof \Traversable) {
153153
$valueCache = null;
154154
$callback = static function () use ($values, &$valueCache) {
155-
return $valueCache ?? $valueCache = iterator_to_array($values, false);
155+
return $valueCache ??= iterator_to_array($values, false);
156156
};
157157
} else {
158158
$callback = null;

src/Symfony/Component/CssSelector/CssSelectorConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ public function __construct(bool $html = true)
6262
*/
6363
public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
6464
{
65-
return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
65+
return $this->cache[$prefix][$cssExpr] ??= $this->translator->cssToXPath($cssExpr, $prefix);
6666
}
6767
}

src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public function get(string $id): mixed
4545
*/
4646
public function getProvidedServices(): array
4747
{
48-
return $this->serviceTypes ?? $this->serviceTypes = array_map(function () { return '?'; }, $this->serviceMap);
48+
return $this->serviceTypes ??= array_map(function () { return '?'; }, $this->serviceMap);
4949
}
5050
}

src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
9898
$targetId,
9999
$targetDefinition,
100100
$value,
101-
$this->lazy || ($this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy()),
101+
$this->lazy || ($this->hasProxyDumper && $targetDefinition?->isLazy()),
102102
ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(),
103103
$this->byConstructor
104104
);
@@ -110,7 +110,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
110110
$targetId,
111111
$targetDefinition,
112112
$value,
113-
$this->lazy || ($targetDefinition && $targetDefinition->isLazy()),
113+
$this->lazy || $targetDefinition?->isLazy(),
114114
true
115115
);
116116
}

src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private function checkTypeDeclarations(Definition $checkedDefinition, \Reflectio
160160
*/
161161
private function checkType(Definition $checkedDefinition, mixed $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, \ReflectionType $reflectionType = null): void
162162
{
163-
$reflectionType = $reflectionType ?? $parameter->getType();
163+
$reflectionType ??= $parameter->getType();
164164

165165
if ($reflectionType instanceof \ReflectionUnionType) {
166166
foreach ($reflectionType->getTypes() as $t) {

0 commit comments

Comments
 (0)