8000 Add more nullsafe operators by nicolas-grekas · Pull Request #44659 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Add more nullsafe operators #44659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ee211c4
[VarDumper] add more "transient-on-macos" groups
nicolas-grekas Dec 15, 2021
6617be4
[HttpKernel] fix how configuring log-level and status-code by excepti…
nicolas-grekas Dec 15, 2021
6bcc3cb
Revert "feature #41989 [Cache] make `LockRegistry` use semaphores whe…
nicolas-grekas Dec 16, 2021
b968514
[Cache] disable lock on CLI
nicolas-grekas Dec 16, 2021
06b25c7
[HttpClient] Fix tracing requests made after calling withOptions()
nicolas-grekas Dec 16, 2021
981cb0c
Remove pointless assignment
derrabus Dec 16, 2021
6312ef2
minor #44674 [Messenger] Remove pointless assignment (derrabus)
nicolas-grekas Dec 16, 2021
d737dab
fix merge
nicolas-grekas Dec 16, 2021
6e3b711
CS fixes
nicolas-grekas Dec 16, 2021
f1914c0
minor #44679 CS fixes (nicolas-grekas)
nicolas-grekas Dec 16, 2021
311dc83
bug #44669 [Cache] disable lock on CLI (nicolas-grekas)
nicolas-grekas Dec 16 8000 , 2021
0812726
[Cache] Fix saving items with no expiration through ProxyAdapter
sbelyshkin Dec 12, 2021
aaa18df
bug #44577 [Cache] Fix proxy no expiration to the Redis (Sergey Belys…
nicolas-grekas Dec 16, 2021
7e26952
Merge branch '4.4' into 5.3
nicolas-grekas Dec 16, 2021
ad3010b
[5.3] cs fixes
nicolas-grekas Dec 16, 2021
f190e9e
bug #44671 [HttpClient] Fix tracing requests made after calling withO…
nicolas-grekas Dec 16, 2021
61be138
Merge branch '5.3' into 5.4
nicolas-grekas Dec 16, 2021
b6d4480
[5.4] cs fixes
nicolas-grekas Dec 16, 2021
eb60956
bug #44667 [Cache] Revert "feature #41989 make `LockRegistry` use se…
nicolas-grekas Dec 16, 2021
646c33f
bug #44649 [HttpKernel] fix how configuring log-level and status-code…
nicolas-grekas Dec 16, 2021
eb749ec
Merge branch '5.4' into 6.0
nicolas-grekas Dec 16, 2021
d5534b0
[6.0] cs fixes
nicolas-grekas Dec 16, 2021
5eb8777
Merge branch '6.0' into 6.1
nicolas-grekas Dec 16, 2021
56f908a
Add more nullsafe operators
nicolas-grekas Dec 16, 2021
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
Prev Previous commit
Add more nullsafe operators
  • Loading branch information
nicolas-grekas committed Dec 16, 2021
commit 56f908a1e169b99e36ea09e00f71256d16446040
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null): void
return;
}

$eventArgs = $eventArgs ?? EventArgs::getEmptyInstance();
$eventArgs ??= EventArgs::getEmptyInstance();

if (!isset($this->initialized[$eventName])) {
$this->initializeListeners($eventName);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/AppVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getSession(): ?Session
}
$request = $this->getRequest();

return $request && $request->hasSession() ? $request->getSession() : null;
return $request?->hasSession() ? $request->getSession() : null;
}

/**
Expand Down
93C6
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getInfo(): array
return [
'response' => $this->response,
'time' => $this->time,
'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener instanceof TraceableAuthenticatorManagerListener ? $this->listener->getAuthenticatorManagerListener() : $this->listener),
'stub' => $this->stub ??= ClassStub::wrapCallable($this->listener instanceof TraceableAuthenticatorManagerListener ? $this->listener->getAuthenticatorManagerListener() : $this->listener),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function onKernelResponse(ResponseEvent $event)

$nonces = [];
if ($this->cspHandler) {
if ($this->dumpDataCollector && $this->dumpDataCollector->getDumpsCount() > 0) {
if ($this->dumpDataCollector?->getDumpsCount() > 0) {
$this->cspHandler->disableCsp();
}

Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Cache/Adapter/ChainAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function __construct(array $adapters, int $defaultLifetime = 0)
$this->adapterCount = \count($this->adapters);
$this->defaultLifetime = $defaultLifetime;

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

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

return $value;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function doFetch(array $ids): iterable

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

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

set_error_handler($this->includeHandler);
try {
$file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id);
$file = $this->files[$id] ??= $this->getFile($id);
$getExpiry = true;

if (isset(self::$valuesCache[$file])) {
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
$this->pool = $itemsPool;
$this->tags = $tagsPool ?? $itemsPool;
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
self::$createCacheItem ?? self::$createCacheItem = \Closure::bind(
self::$createCacheItem ??= \Closure::bind(
static function ($key, $value, CacheItem $protoItem) {
$item = new CacheItem();
$item->key = $key;
Expand All @@ -61,7 +61,7 @@ static function ($key, $value, CacheItem $protoItem) {
null,
CacheItem::class
);
self::$setCacheItemTags ?? self::$setCacheItemTags = \Closure::bind(
self::$setCacheItemTags ??= \Closure::bind(
static function (CacheItem $item, $key, array &$itemTags) {
$item->isTaggable = true;
if (!$item->isHit) {
Expand All @@ -82,7 +82,7 @@ static function (CacheItem $item, $key, array &$itemTags) {
null,
CacheItem::class
);
self::$getTagsByKey ?? self::$getTagsByKey = \Closure::bind(
self::$getTagsByKey ??= \Closure::bind(
static function ($deferred) {
$tagsByKey = [];
foreach ($deferred as $key => $item) {
Expand All @@ -95,7 +95,7 @@ static function ($deferred) {
null,
CacheItem::class
);
self::$saveTags ?? self::$saveTags = \Closure::bind(
self::$saveTags ??= \Closure::bind(
static function (AdapterInterface $tagsAdapter, array $tags) {
ksort($tags);

Expand Down Expand Up @@ -394,7 +394,7 @@ private function getTagVersions(array $tagsByKey): array
$newVersion = null;
foreach ($this->tags->getItems(array_keys($tags)) as $tag => $version) {
if (!$version->isHit()) {
$newTags[$tag] = $version->set($newVersion ?? $newVersion = random_int(\PHP_INT_MIN, \PHP_INT_MAX));
$newTags[$tag] = $version->set($newVersion ??= random_int(\PHP_INT_MIN, \PHP_INT_MAX));
}
$tagVersions[$tag = $tags[$tag]] = $version->get();
$this->knownTagVersions[$tag] = [$now, $tagVersions[$tag]];
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Cache/LockRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s
$locked = flock($lock, \LOCK_EX | \LOCK_NB, $wouldBlock);

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function unmarshall(string $value): mixed
return null;
}
static $igbinaryNull;
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
if ($value === $igbinaryNull ??= \extension_loaded('igbinary') ? igbinary_serialize(null) : false) {
return null;
}
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __invoke(callable $callback, CacheItem $item, bool &$save, Adapt
{
if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) {
// The item is stale or the callback cannot be reversed: we must compute the value now
$logger && $logger->info('Computing item "{key}" online: '.($item->isHit() ? 'callback cannot be reversed' : 'item is stale'), ['key' => $item->getKey()]);
$logger?->info('Computing item "{key}" online: '.($item->isHit() ? 'callback cannot be reversed' : 'item is stale'), ['key' => $item->getKey()]);

return null !== $this->callbackWrapper ? ($this->callbackWrapper)($callback, $item, $save, $pool, $setMetadata, $logger) : $callback($item, $save);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __invoke(EarlyExpirationMessage $message)

static $setMetadata;

$setMetadata ?? $setMetadata = \Closure::bind(
$setMetadata ??= \Closure::bind(
function (CacheItem $item, float $startTime) {
if ($item->expiry > $endTime = microtime(true)) {
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Traits/ContractsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable

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

static $setMetadata;

$setMetadata ?? $setMetadata = \Closure::bind(
$setMetadata ??= \Closure::bind(
static function (CacheItem $item, float $startTime, ?array &$metadata) {
if ($item->expiry > $endTime = microtime(true)) {
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ protected function doDelete(array $ids): bool

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

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

if ($redis instanceof RedisClusterProxy || $redis instanceof \RedisCluster || ($redis instanceof \Predis\ClientInterface && $redis->getConnection() instanceof RedisCluster)) {
// phpredis & predis don't support pipelining with RedisCluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TreeBuilder implements NodeParentInterface

public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
{
$builder = $builder ?? new NodeBuilder();
$builder ??= new NodeBuilder();
$this->root = $builder->node($name, $type)->setParent($this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +1 F41A 48,7 @@ public function testSetExtraKeyMethodIsNotGeneratedWhenAllowExtraKeysIsFalse()
*/
private function generateConfigBuilder(string $configurationClass, string $outputDir = null)
{
$outputDir ?? $outputDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
$outputDir ??= sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
if (!str_contains($outputDir, __DIR__)) {
$this->tempDir[] = $outputDir;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public function has(string $name): bool
{
$this->init();

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

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public function getHelp(): string
public function getProcessedHelp(): string
{
$name = $this->name;
$isSingleCommand = $this->application && $this->application->isSingleCommand();
$isSingleCommand = $this->application?->isSingleCommand();

$placeholders = [
'%command.name%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function bind(InputDefinition $definition): void
return;
}

if (null !== $option && $option->acceptValue()) {
if ($option?->acceptValue()) {
$this->completionType = self::TYPE_OPTION_VALUE;
$this->completionName = $option->getName();
$this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
Expand All @@ -97,7 +97,7 @@ public function bind(InputDefinition $definition): void
if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
// check if previous option accepted a value
$previousOption = $this->getOptionFromToken($previousToken);
if (null !== $previousOption && $previousOption->acceptValue()) {
if ($previousOption?->acceptValue()) {
$this->completionType = self::TYPE_OPTION_VALUE;
$this->completionName = $previousOption->getName();
$this->completionValue = $relevantToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function process(ContainerBuilder $container)
$lazyCommandMap[$tag['command']] = $id;
}

$description = $description ?? $tag['description'] ?? null;
$description ??= $tag['description'] ?? null;
}

$definition->addMethodCall('setName', [$commandName]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function format(?string $message): ?string
public function getStyle(string $name): OutputFormatterStyleInterface
{
// to comply with the interface we must return a OutputFormatterStyleInterface
return $this->style ?? $this->style = new NullOutputFormatterStyle();
return $this->style ??= new NullOutputFormatterStyle();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Helper/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function __construct(OutputInterface $output, CliDumper $dumper = null, C

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

return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
return rtrim($dumper->dump(($this->cloner ??= new VarCloner())->cloneVar($var)->withRefHandles(false), true));
};
} else {
$this->handler = function ($var): string {
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Console/Helper/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getHelperSet(): ?HelperSet
*/
public static function width(?string $string): int
{
$string ?? $string = '';
$string ??= '';

if (preg_match('//u', $string)) {
return (new UnicodeString($string))->width(false);
Expand All @@ -64,7 +64,7 @@ public static function width(?string $string): int
*/
public static function length(?string $string): int
{
$string ?? $string = '';
$string ??= '';

if (preg_match('//u', $string)) {
return (new UnicodeString($string))->length();
Expand All @@ -82,7 +82,7 @@ public static function length(?string $string): int
*/
public static function substr(?string $string, int $from, int $length = null): string
{
$string ?? $string = '';
$string ??= '';

if (false === $encoding = mb_detect_encoding($string, null, true)) {
return substr($string, $from, $length);
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 @@ -45,7 +45,7 @@ class ArgvInput extends Input

public function __construct(array $argv = null, InputDefinition $definition = null)
{
$argv = $argv ?? $_SERVER['argv'] ?? [];
$argv ??= $_SERVER['argv'] ?? [];

// strip the application name
array_shift($argv);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Question/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function setAutocompleterValues(?iterable $values): static
} elseif ($values instanceof \Traversable) {
$valueCache = null;
$callback = static function () use ($values, &$valueCache) {
return $valueCache ?? $valueCache = iterator_to_array($values, false);
return $valueCache ??= iterator_to_array($values, false);
};
} else {
$callback = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/CssSelector/CssSelectorConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ public function __construct(bool $html = true)
*/
public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
{
return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
return $this->cache[$prefix][$cssExpr] ??= $this->translator->cssToXPath($cssExpr, $prefix);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function get(string $id): mixed
*/
public function getProvidedServices(): array
{
return $this->serviceTypes ?? $this->serviceTypes = array_map(function () { return '?'; }, $this->serviceMap);
return $this->serviceTypes ??= array_map(function () { return '?'; }, $this->serviceMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
$targetId,
$targetDefinition,
$value,
$this->lazy || ($this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy()),
$this->lazy || ($this->hasProxyDumper && $targetDefinition?->isLazy()),
ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(),
$this->byConstructor
);
Expand All @@ -110,7 +110,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
$targetId,
$targetDefinition,
$value,
$this->lazy || ($targetDefinition && $targetDefinition->isLazy()),
$this->lazy || $targetDefinition?->isLazy(),
true
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private function checkTypeDeclarations(Definition $checkedDefinition, \Reflectio
*/
private function checkType(Definition $checkedDefinition, mixed $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, \ReflectionType $reflectionType = null): void
{
$reflectionType = $reflectionType ?? $parameter->getType();
$reflectionType ??= $parameter->getType();

if ($reflectionType instanceof \ReflectionUnionType) {
foreach ($reflectionType->getTypes() as $t) {
Expand Down
Loading
0