Skip to content

Commit 82fdf40

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: CS: Apply ternary_to_null_coalescing fixer
2 parents 535a2bf + 4594c63 commit 82fdf40

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Console/Descriptor/JsonDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function describeCallable($callable, array $options = [])
145145

146146
protected function describeContainerParameter($parameter, array $options = [])
147147
{
148-
$key = isset($options['parameter']) ? $options['parameter'] : '';
148+
$key = $options['parameter'] ?? '';
149149

150150
$this->writeData([$key => $parameter], $options);
151151
}
@@ -181,7 +181,7 @@ protected function describeContainerDeprecations(ContainerBuilder $builder, arra
181181

182182
private function writeData(array $data, array $options)
183183
{
184-
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
184+
$flags = $options['json_encoding'] ?? 0;
185185

186186
$this->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
187187
}

Console/Descriptor/TextDescriptor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function describeRoute(Route $route, array $options = [])
8989

9090
$tableHeaders = ['Property', 'Value'];
9191
$tableRows = [
92-
['Route Name', isset($options['name']) ? $options['name'] : ''],
92+
['Route Name', $options['name'] ?? ''],
9393
['Path', $route->getPath()],
9494
['Path Regex', $route->compile()->getRegex()],
9595
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
@@ -155,7 +155,7 @@ protected function describeContainerService($service, array $options = [], Conta
155155
$options['output']->table(
156156
['Service ID', 'Class'],
157157
[
158-
[isset($options['id']) ? $options['id'] : '-', \get_class($service)],
158+
[$options['id'] ?? '-', \get_class($service)],
159159
]
160160
);
161161
}
@@ -164,7 +164,7 @@ protected function describeContainerService($service, array $options = [], Conta
164164
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
165165
{
166166
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
167-
$showTag = isset($options['tag']) ? $options['tag'] : null;
167+
$showTag = $options['tag'] ?? null;
168168

169169
if ($showHidden) {
170170
$title = 'Symfony Container Hidden Services';
@@ -228,7 +228,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
228228
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
229229
$tagValues = [];
230230
foreach ($tagsNames as $tagName) {
231-
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
231+
$tagValues[] = $tag[$tagName] ?? '';
232232
}
233233
if (0 === $key) {
234234
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
@@ -262,7 +262,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
262262

263263
$tableHeaders = ['Option', 'Value'];
264264

265-
$tableRows[] = ['Service ID', isset($options['id']) ? $options['id'] : '-'];
265+
$tableRows[] = ['Service ID', $options['id'] ?? '-'];
266266
$tableRows[] = ['Class', $definition->getClass() ?: '-'];
267267

268268
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];

Console/Descriptor/XmlDescriptor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
3939

4040
protected function describeRoute(Route $route, array $options = [])
4141
{
42-
$this->writeDocument($this->getRouteDocument($route, isset($options['name']) ? $options['name'] : null));
42+
$this->writeDocument($this->getRouteDocument($route, $options['name'] ?? null));
4343
}
4444

4545
protected function describeContainerParameters(ParameterBag $parameters, array $options = [])
@@ -63,18 +63,18 @@ protected function describeContainerService($service, array $options = [], Conta
6363

6464
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
6565
{
66-
$this->writeDocument($this->getContainerServicesDocument($builder, isset($options['tag']) ? $options['tag'] : null, isset($options['show_hidden']) && $options['show_hidden'], isset($options['show_arguments']) && $options['show_arguments'], isset($options['filter']) ? $options['filter'] : null));
66+
$this->writeDocument($this->getContainerServicesDocument($builder, $options['tag'] ?? null, isset($options['show_hidden']) && $options['show_hidden'], isset($options['show_arguments']) && $options['show_arguments'], $options['filter'] ?? null));
6767
}
6868

6969
protected function describeContainerDefinition(Definition $definition, array $options = [])
7070
{
71-
$this->writeDocument($this->getContainerDefinitionDocument($definition, isset($options['id']) ? $options['id'] : null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
71+
$this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
7272
}
7373

7474
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
7575
{
7676
$dom = new \DOMDocument('1.0', 'UTF-8');
77-
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
77+
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, $options['id'] ?? null)->childNodes->item(0), true));
7878

7979
if (!$builder) {
8080
$this->writeDocument($dom);

DependencyInjection/Compiler/ProfilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function process(ContainerBuilder $container)
3535
$collectors = new \SplPriorityQueue();
3636
$order = \PHP_INT_MAX;
3737
foreach ($container->findTaggedServiceIds('data_collector', true) as $id => $attributes) {
38-
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
38+
$priority = $attributes[0]['priority'] ?? 0;
3939
$template = null;
4040

4141
$collectorClass = $container->findDefinition($id)->getClass();

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
282282
// mark any env vars found in the ide setting as used
283283
$container->resolveEnvPlaceholders($ide);
284284

285-
$container->setParameter('debug.file_link_format', str_replace('%', '%%', ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')) ?: (isset($links[$ide]) ? $links[$ide] : $ide));
285+
$container->setParameter('debug.file_link_format', str_replace('%', '%%', ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')) ?: ($links[$ide] ?? $ide));
286286
}
287287

288288
if (!empty($config['test'])) {
@@ -1077,7 +1077,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
10771077
} else {
10781078
// let format fallback to main version_format
10791079
$format = $package['version_format'] ?: $config['version_format'];
1080-
$version = isset($package['version']) ? $package['version'] : null;
1080+
$version = $package['version'] ?? null;
10811081
$version = $this->createVersion($container, $version, $format, $package['json_manifest_path'], $name);
10821082
}
10831083

Tests/Functional/AbstractWebTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ protected static function createKernel(array $options = []): KernelInterface
6161
return new $class(
6262
static::getVarDir(),
6363
$options['test_case'],
64-
isset($options['root_config']) ? $options['root_config'] : 'config.yml',
65-
isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
66-
isset($options['debug']) ? $options['debug'] : false
64+
$options['root_config'] ?? 'config.yml',
65+
$options['environment'] ?? strtolower(static::getVarDir().$options['test_case']),
66+
$options['debug'] ?? false
6767
);
6868
}
6969

Tests/Routing/RouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ private function getParameterBag(array $params = []): ContainerInterface
551551
->expects($this->any())
552552
->method('get')
553553
->willReturnCallback(function ($key) use ($params) {
554-
return isset($params[$key]) ? $params[$key] : null;
554+
return $params[$key] ?? null;
555555
})
556556
;
557557

0 commit comments

Comments
 (0)