Skip to content

Commit 1e91712

Browse files
committed
CS: Apply ternary_to_null_coalescing fixer
1 parent 176b10c commit 1e91712

23 files changed

+34
-34
lines changed

Console/Descriptor/JsonDescriptor.php

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

145145
protected function describeContainerParameter($parameter, array $options = [])
146146
{
147-
$key = isset($options['parameter']) ? $options['parameter'] : '';
147+
$key = $options['parameter'] ?? '';
148148

149149
$this->writeData([$key => $parameter], $options);
150150
}
@@ -156,7 +156,7 @@ protected function describeContainerEnvVars(array $envs, array $options = [])
156156

157157
private function writeData(array $data, array $options)
158158
{
159-
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
159+
$flags = $options['json_encoding'] ?? 0;
160160

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

Console/Descriptor/TextDescriptor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function describeRoute(Route $route, array $options = [])
8484
{
8585
$tableHeaders = ['Property', 'Value'];
8686
$tableRows = [
87-
['Route Name', isset($options['name']) ? $options['name'] : ''],
87+
['Route Name', $options['name'] ?? ''],
8888
['Path', $route->getPath()],
8989
['Path Regex', $route->compile()->getRegex()],
9090
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
@@ -150,7 +150,7 @@ protected function describeContainerService($service, array $options = [], Conta
150150
$options['output']->table(
151151
['Service ID', 'Class'],
152152
[
153-
[isset($options['id']) ? $options['id'] : '-', \get_class($service)],
153+
[$options['id'] ?? '-', \get_class($service)],
154154
]
155155
);
156156
}
@@ -159,7 +159,7 @@ protected function describeContainerService($service, array $options = [], Conta
159159
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
160160
{
161161
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
162-
$showTag = isset($options['tag']) ? $options['tag'] : null;
162+
$showTag = $options['tag'] ?? null;
163163

164164
if ($showHidden) {
165165
$title = 'Symfony Container Hidden Services';
@@ -223,7 +223,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
223223
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
224224
$tagValues = [];
225225
foreach ($tagsNames as $tagName) {
226-
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
226+
$tagValues[] = $tag[$tagName] ?? '';
227227
}
228228
if (0 === $key) {
229229
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
@@ -257,7 +257,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
257257

258258
$tableHeaders = ['Option', 'Value'];
259259

260-
$tableRows[] = ['Service ID', isset($options['id']) ? $options['id'] : '-'];
260+
$tableRows[] = ['Service ID', $options['id'] ?? '-'];
261261
$tableRows[] = ['Class', $definition->getClass() ?: '-'];
262262

263263
$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
@@ -38,7 +38,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
3838

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

4444
protected function describeContainerParameters(ParameterBag $parameters, array $options = [])
@@ -62,18 +62,18 @@ protected function describeContainerService($service, array $options = [], Conta
6262

6363
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
6464
{
65-
$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));
65+
$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));
6666
}
6767

6868
protected function describeContainerDefinition(Definition $definition, array $options = [])
6969
{
70-
$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']));
70+
$this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
7171
}
7272

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

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

DependencyInjection/Compiler/ProfilerPass.php

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

4040
if (isset($attributes[0]['template'])) {

DependencyInjection/FrameworkExtension.php

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

233-
$container->setParameter('templating.helper.code.file_link_format', str_replace('%', '%%', ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')) ?: (isset($links[$ide]) ? $links[$ide] : $ide));
233+
$container->setParameter('templating.helper.code.file_link_format', str_replace('%', '%%', ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')) ?: ($links[$ide] ?? $ide));
234234
}
235235
$container->setParameter('debug.file_link_format', '%templating.helper.code.file_link_format%');
236236
}
@@ -1083,7 +1083,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
10831083
} else {
10841084
// let format fallback to main version_format
10851085
$format = $package['version_format'] ?: $config['version_format'];
1086-
$version = isset($package['version']) ? $package['version'] : null;
1086+
$version = $package['version'] ?? null;
10871087
$version = $this->createVersion($container, $version, $format, $package['json_manifest_path'], $name);
10881088
}
10891089

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'color']);
1+
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'color']);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'email']) ?>
1+
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'email']) ?>

Resources/views/Form/form_label.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php if (false !== $label): ?>
2-
<?php if ($required) { $label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '').' required'); } ?>
2+
<?php if ($required) { $label_attr['class'] = trim(($label_attr['class'] ?? '').' required'); } ?>
33
<?php if (!$compound) { $label_attr['for'] = $id; } ?>
44
<?php if (!$label) { $label = isset($label_format)
55
? strtr($label_format, ['%name%' => $name, '%id%' => $id])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'hidden']) ?>
1+
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'hidden']) ?>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'number']) ?>
1+
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'number']) ?>

0 commit comments

Comments
 (0)