Skip to content

Commit e681bd5

Browse files
committed
Add a few more ??=
1 parent 4d09837 commit e681bd5

File tree

22 files changed

+38
-38
lines changed

22 files changed

+38
-38
lines changed

src/Symfony/Bridge/Twig/Extension/DumpExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function dump(Environment $env, array $context): ?string
6868
}
6969

7070
$dump = fopen('php://memory', 'r+');
71-
$this->dumper = $this->dumper ?? new HtmlDumper();
71+
$this->dumper ??= new HtmlDumper();
7272
$this->dumper->setCharset($env->getCharset());
7373

7474
foreach ($vars as $value) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function createSystemCache(string $namespace, int $defaultLifetime
9494
$opcache->setLogger($logger);
9595
}
9696

97-
if (!self::$apcuSupported = self::$apcuSupported ?? ApcuAdapter::isSupported()) {
97+
if (!self::$apcuSupported ??= ApcuAdapter::isSupported()) {
9898
return $opcache;
9999
}
100100

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,17 @@ private static function getOptions(string $options): array
141141

142142
private static function initOptions(array $options): array
143143
{
144-
$options['username'] = $options['username'] ?? '';
145-
$options['password'] = $options['password'] ?? '';
146-
$options['operationTimeout'] = $options['operationTimeout'] ?? 0;
147-
$options['configTimeout'] = $options['configTimeout'] ?? 0;
148-
$options['configNodeTimeout'] = $options['configNodeTimeout'] ?? 0;
149-
$options['n1qlTimeout'] = $options['n1qlTimeout'] ?? 0;
150-
$options['httpTimeout'] = $options['httpTimeout'] ?? 0;
151-
$options['configDelay'] = $options['configDelay'] ?? 0;
152-
$options['htconfigIdleTimeout'] = $options['htconfigIdleTimeout'] ?? 0;
153-
$options['durabilityInterval'] = $options['durabilityInterval'] ?? 0;
154-
$options['durabilityTimeout'] = $options['durabilityTimeout'] ?? 0;
144+
$options['username'] ??= '';
145+
$options['password'] ??= '';
146+
$options['operationTimeout'] ??= 0;
147+
$options['configTimeout'] ??= 0;
148+
$options['configNodeTimeout'] ??= 0;
149+
$options['n1qlTimeout'] ??= 0;
150+
$options['httpTimeout'] ??= 0;
151+
$options['configDelay'] ??= 0;
152+
$options['htconfigIdleTimeout'] ??= 0;
153+
$options['durabilityInterval'] ??= 0;
154+
$options['durabilityTimeout'] ??= 0;
155155

156156
return $options;
157157
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
4646
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, bool $appendOnly = false)
4747
{
4848
$this->appendOnly = $appendOnly;
49-
self::$startTime = self::$startTime ?? $_SERVER['REQUEST_TIME'] ?? time();
49+
self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time();
5050
parent::__construct('', $defaultLifetime);
5151
$this->init($namespace, $directory);
5252
$this->includeHandler = static function ($type, $msg, $file, $line) {
@@ -56,7 +56,7 @@ public function __construct(string $namespace = '', int $defaultLifetime = 0, st
5656

5757
public static function isSupported()
5858
{
59-
self::$startTime = self::$startTime ?? $_SERVER['REQUEST_TIME'] ?? time();
59+
self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time();
6060

6161
return \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOL));
6262
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function canBeEnabled(): static
246246
->beforeNormalization()
247247
->ifArray()
248248
->then(function (array $v) {
249-
$v['enabled'] = $v['enabled'] ?? true;
249+
$v['enabled'] ??= true;
250250

251251
return $v;
252252
})

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function process(ContainerBuilder $container)
7373
continue;
7474
}
7575

76-
$event['method'] = $event['method'] ?? '__invoke';
76+
$event['method'] ??= '__invoke';
7777
$event['event'] = $this->getEventFromTypeDeclaration($container, $id, $event['method']);
7878
}
7979

src/Symfony/Component/HttpClient/Internal/AmpListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(array &$info, array $pinSha256, \Closure $onProgress
5050

5151
public function startRequest(Request $request): Promise
5252
{
53-
$this->info['start_time'] = $this->info['start_time'] ?? microtime(true);
53+
$this->info['start_time'] ??= microtime(true);
5454
($this->onProgress)();
5555

5656
return new Success();

src/Symfony/Component/HttpClient/Internal/CurlClientState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class CurlClientState extends ClientState
3838

3939
public function __construct(int $maxHostConnections, int $maxPendingPushes)
4040
{
41-
self::$curlVersion = self::$curlVersion ?? curl_version();
41+
self::$curlVersion ??= curl_version();
4242

4343
$this->handle = curl_multi_init();
4444
$this->dnsCache = new DnsCache();

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(CurlClientState $multi, \CurlHandle|string $ch, arra
6868
$this->info['http_method'] = $method;
6969
$this->info['user_data'] = $options['user_data'] ?? null;
7070
$this->info['max_duration'] = $options['max_duration'] ?? null;
71-
$this->info['start_time'] = $this->info['start_time'] ?? microtime(true);
71+
$this->info['start_time'] ??= microtime(true);
7272
$this->info['original_url'] = $originalUrl ?? $this->info['url'] ?? curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL);
7373
$info = &$this->info;
7474
$headers = &$this->headers;

src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function loadSession()
208208

209209
foreach ($bags as $bag) {
210210
$key = $bag->getStorageKey();
211-
$this->data[$key] = $this->data[$key] ?? [];
211+
$this->data[$key] ??= [];
212212
$bag->initialize($this->data[$key]);
213213
}
214214

0 commit comments

Comments
 (0)