Skip to content

Commit 4a053e5

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: CS: Apply ternary_to_null_coalescing fixer
2 parents a952f0f + 6bf07f2 commit 4a053e5

File tree

114 files changed

+235
-239
lines changed

Some content is hidden

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

114 files changed

+235
-239
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
1717
'combine_nested_dirname' => true,
1818
'list_syntax' => ['syntax' => 'short'],
1919
'visibility_required' => ['property', 'method', 'const'],
20+
'ternary_to_null_coalescing' => true,
2021
])
2122
->setRiskyAllowed(true)
2223
->setFinder(

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private function findAndSortTags(string $tagName, ContainerBuilder $container):
134134

135135
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $tags) {
136136
foreach ($tags as $attributes) {
137-
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
137+
$priority = $attributes['priority'] ?? 0;
138138
$sortedTags[$priority][] = [$serviceId, $attributes];
139139
}
140140
}

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function validate($entity, Constraint $constraint)
165165
}
166166

167167
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
168-
$invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]];
168+
$invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]];
169169

170170
$this->context->buildViolation($constraint->message)
171171
->atPath($errorPath)

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __invoke(array $record)
3838
'priority' => $record['level'],
3939
'priorityName' => $record['level_name'],
4040
'context' => $record['context'],
41-
'channel' => isset($record['channel']) ? $record['channel'] : '',
41+
'channel' => $record['channel'] ?? '',
4242
];
4343

4444
if (!isset($this->errorCount[$hash])) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(FragmentHandler $handler)
3737
*/
3838
public function renderFragment($uri, array $options = []): string
3939
{
40-
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
40+
$strategy = $options['strategy'] ?? 'inline';
4141
unset($options['strategy']);
4242

4343
return $this->handler->render($uri, $strategy, $options);

src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function compile(Compiler $compiler): void
4040
// The "label" function expects the label in the second and
4141
// the variables in the third argument
4242
$label = $arguments[1];
43-
$variables = isset($arguments[2]) ? $arguments[2] : null;
43+
$variables = $arguments[2] ?? null;
4444
$lineno = $label->getTemplateLine();
4545

4646
if ($label instanceof ConstantExpression) {

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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'];

src/Symfony/Bundle/FrameworkBundle/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);

src/Symfony/Bundle/FrameworkBundle/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();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy