diff --git a/.php_cs.dist b/.php_cs.dist
index 21c183fc88..862b6cda7f 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
'combine_nested_dirname' => true,
'list_syntax' => ['syntax' => 'short'],
'visibility_required' => ['property', 'method', 'const'],
+ 'ternary_to_null_coalescing' => true,
])
->setRiskyAllowed(true)
->setFinder(
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
index d2c8343ddb..4f9137bbe5 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
@@ -134,7 +134,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $tags) {
foreach ($tags as $attributes) {
- $priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
+ $priority = $attributes['priority'] ?? 0;
$sortedTags[$priority][] = [$serviceId, $attributes];
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
index 35f723aa88..4324dfde55 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
@@ -165,7 +165,7 @@ class UniqueEntityValidator extends ConstraintValidator
}
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
- $invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]];
+ $invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]];
$this->context->buildViolation($constraint->message)
->atPath($errorPath)
diff --git a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
index 6eec887d6f..11f075fe3a 100644
--- a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
+++ b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
@@ -38,7 +38,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
'priority' => $record['level'],
'priorityName' => $record['level_name'],
'context' => $record['context'],
- 'channel' => isset($record['channel']) ? $record['channel'] : '',
+ 'channel' => $record['channel'] ?? '',
];
if (!isset($this->errorCount[$hash])) {
diff --git a/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php b/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
index e0dbb5b356..edcf8a4dc0 100644
--- a/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
+++ b/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
@@ -42,7 +42,7 @@ class HttpKernelRuntime
*/
public function renderFragment($uri, $options = [])
{
- $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
+ $strategy = $options['strategy'] ?? 'inline';
unset($options['strategy']);
return $this->handler->render($uri, $strategy, $options);
diff --git a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php
index 5db8d92244..bf22c329d6 100644
--- a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php
+++ b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php
@@ -45,7 +45,7 @@ class SearchAndRenderBlockNode extends FunctionExpression
// The "label" function expects the label in the second and
// the variables in the third argument
$label = $arguments[1];
- $variables = isset($arguments[2]) ? $arguments[2] : null;
+ $variables = $arguments[2] ?? null;
$lineno = $label->getTemplateLine();
if ($label instanceof ConstantExpression) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index 7fa48b9379..bb723deaaf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -144,7 +144,7 @@ class JsonDescriptor extends Descriptor
protected function describeContainerParameter($parameter, array $options = [])
{
- $key = isset($options['parameter']) ? $options['parameter'] : '';
+ $key = $options['parameter'] ?? '';
$this->writeData([$key => $parameter], $options);
}
@@ -156,7 +156,7 @@ class JsonDescriptor extends Descriptor
private function writeData(array $data, array $options)
{
- $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
+ $flags = $options['json_encoding'] ?? 0;
$this->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index a2af0c7949..1e27e07365 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -84,7 +84,7 @@ class TextDescriptor extends Descriptor
{
$tableHeaders = ['Property', 'Value'];
$tableRows = [
- ['Route Name', isset($options['name']) ? $options['name'] : ''],
+ ['Route Name', $options['name'] ?? ''],
['Path', $route->getPath()],
['Path Regex', $route->compile()->getRegex()],
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
@@ -150,7 +150,7 @@ class TextDescriptor extends Descriptor
$options['output']->table(
['Service ID', 'Class'],
[
- [isset($options['id']) ? $options['id'] : '-', \get_class($service)],
+ [$options['id'] ?? '-', \get_class($service)],
]
);
}
@@ -159,7 +159,7 @@ class TextDescriptor extends Descriptor
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
{
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
- $showTag = isset($options['tag']) ? $options['tag'] : null;
+ $showTag = $options['tag'] ?? null;
if ($showHidden) {
$title = 'Symfony Container Hidden Services';
@@ -223,7 +223,7 @@ class TextDescriptor extends Descriptor
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
$tagValues = [];
foreach ($tagsNames as $tagName) {
- $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
+ $tagValues[] = $tag[$tagName] ?? '';
}
if (0 === $key) {
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
@@ -257,7 +257,7 @@ class TextDescriptor extends Descriptor
$tableHeaders = ['Option', 'Value'];
- $tableRows[] = ['Service ID', isset($options['id']) ? $options['id'] : '-'];
+ $tableRows[] = ['Service ID', $options['id'] ?? '-'];
$tableRows[] = ['Class', $definition->getClass() ?: '-'];
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
index 3839cbc4ed..b11674a31b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
@@ -38,7 +38,7 @@ class XmlDescriptor extends Descriptor
protected function describeRoute(Route $route, array $options = [])
{
- $this->writeDocument($this->getRouteDocument($route, isset($options['name']) ? $options['name'] : null));
+ $this->writeDocument($this->getRouteDocument($route, $options['name'] ?? null));
}
protected function describeContainerParameters(ParameterBag $parameters, array $options = [])
@@ -62,18 +62,18 @@ class XmlDescriptor extends Descriptor
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
{
- $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));
+ $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));
}
protected function describeContainerDefinition(Definition $definition, array $options = [])
{
- $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']));
+ $this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
}
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
- $dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
+ $dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, $options['id'] ?? null)->childNodes->item(0), true));
if (!$builder) {
$this->writeDocument($dom);
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php
index 4318081db3..7814098582 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php
@@ -34,7 +34,7 @@ class ProfilerPass implements CompilerPassInterface
$collectors = new \SplPriorityQueue();
$order = \PHP_INT_MAX;
foreach ($container->findTaggedServiceIds('data_collector', true) as $id => $attributes) {
- $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
+ $priority = $attributes[0]['priority'] ?? 0;
$template = null;
if (isset($attributes[0]['template'])) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index fe2778fdc6..f19c7a80ef 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -230,7 +230,7 @@ class FrameworkExtension extends Extension
// mark any env vars found in the ide setting as used
$container->resolveEnvPlaceholders($ide);
- $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));
+ $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));
}
$container->setParameter('debug.file_link_format', '%templating.helper.code.file_link_format%');
}
@@ -1083,7 +1083,7 @@ class FrameworkExtension extends Extension
} else {
// let format fallback to main version_format
$format = $package['version_format'] ?: $config['version_format'];
- $version = isset($package['version']) ? $package['version'] : null;
+ $version = $package['version'] ?? null;
$version = $this->createVersion($container, $version, $format, $package['json_manifest_path'], $name);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/color_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/color_widget.html.php
index 48f5c2c30d..74b5e6f72c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/color_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/color_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'color']);
+block($form, 'form_widget_simple', ['type' => $type ?? 'color']);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php
index fa6b0ee8a1..96bfbcacc2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'email']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'email']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php
index b3465042ef..a17a5ca2ab 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php
@@ -1,5 +1,5 @@
-
+
$name, '%id%' => $id])
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php
index 6bcbb5e046..15df70208e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'hidden']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'hidden']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php
index faaff51e67..64ae6b76ec 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'number']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'number']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php
index 3d6f79c63b..225aa31573 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'text']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'text']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php
index 5514468f6a..ea6c6ab479 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'password']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'password']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php
index 163e1f18f6..47ae89f50a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_widget.html.php
@@ -1,2 +1,2 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'text']).$view->escape($symbol) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'text']).$view->escape($symbol) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/range_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/range_widget.html.php
index d6650d8154..97f4a497f5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/range_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/range_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'range']);
+block($form, 'form_widget_simple', ['type' => $type ?? 'range']);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php
index af45b15669..117327b16e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php
@@ -1 +1 @@
-block($form, 'button_widget', ['type' => isset($type) ? $type : 'reset']) ?>
+block($form, 'button_widget', ['type' => $type ?? 'reset']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php
index 191279b517..6b6efa7b75 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'search']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'search']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php
index baea833326..db643c2423 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php
@@ -1 +1 @@
-block($form, 'button_widget', ['type' => isset($type) ? $type : 'submit']) ?>
+block($form, 'button_widget', ['type' => $type ?? 'submit']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/tel_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/tel_widget.html.php
index dd471b9518..fb62226c1d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/tel_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/tel_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'tel']);
+block($form, 'form_widget_simple', ['type' => $type ?? 'tel']);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php
index cd653c89c5..fee20f07c9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php
@@ -1 +1 @@
-block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'url']) ?>
+block($form, 'form_widget_simple', ['type' => $type ?? 'url']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php
index 06e24fb788..3e689f5934 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php
@@ -44,7 +44,7 @@ class ActionsHelper extends Helper
*/
public function render($uri, array $options = [])
{
- $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
+ $strategy = $options['strategy'] ?? 'inline';
unset($options['strategy']);
return $this->handler->render($uri, $strategy, $options);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
index 9bf91ec213..bce53b8668 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php
@@ -61,9 +61,9 @@ abstract class AbstractWebTestCase extends BaseWebTestCase
return new $class(
static::getVarDir(),
$options['test_case'],
- isset($options['root_config']) ? $options['root_config'] : 'config.yml',
- isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
- isset($options['debug']) ? $options['debug'] : false
+ $options['root_config'] ?? 'config.yml',
+ $options['environment'] ?? strtolower(static::getVarDir().$options['test_case']),
+ $options['debug'] ?? false
);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
index f7971cb733..1e6578929c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
@@ -551,7 +551,7 @@ class RouterTest extends TestCase
->expects($this->any())
->method('get')
->willReturnCallback(function ($key) use ($params) {
- return isset($params[$key]) ? $params[$key] : null;
+ return $params[$key] ?? null;
})
;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Parent/form_widget_simple.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Parent/form_widget_simple.html.php
index 1b53a7213f..235028ee00 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Parent/form_widget_simple.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Parent/form_widget_simple.html.php
@@ -1,2 +1,2 @@
-
+
block($form, 'widget_attributes'); ?> value="" rel="theme" />
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index eec8f4675b..ab56ce26b9 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -283,9 +283,9 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
if (isset($firewall['request_matcher'])) {
$matcher = new Reference($firewall['request_matcher']);
} elseif (isset($firewall['pattern']) || isset($firewall['host'])) {
- $pattern = isset($firewall['pattern']) ? $firewall['pattern'] : null;
- $host = isset($firewall['host']) ? $firewall['host'] : null;
- $methods = isset($firewall['methods']) ? $firewall['methods'] : [];
+ $pattern = $firewall['pattern'] ?? null;
+ $host = $firewall['host'] ?? null;
+ $methods = $firewall['methods'] ?? [];
$matcher = $this->createRequestMatcher($container, $pattern, $host, null, $methods);
}
@@ -394,7 +394,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
}
// Determine default entry point
- $configuredEntryPoint = isset($firewall['entry_point']) ? $firewall['entry_point'] : null;
+ $configuredEntryPoint = $firewall['entry_point'] ?? null;
// Authentication listeners
[$authListeners, $defaultEntryPoint] = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $providerIds, $configuredEntryPoint, $contextListenerId);
@@ -415,8 +415,8 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
// Exception listener
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless']));
- $config->replaceArgument(8, isset($firewall['access_denied_handler']) ? $firewall['access_denied_handler'] : null);
- $config->replaceArgument(9, isset($firewall['access_denied_url']) ? $firewall['access_denied_url'] : null);
+ $config->replaceArgument(8, $firewall['access_denied_handler'] ?? null);
+ $config->replaceArgument(9, $firewall['access_denied_url'] ?? null);
$container->setAlias('security.user_checker.'.$id, new Alias($firewall['user_checker'], false));
@@ -430,7 +430,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
}
$config->replaceArgument(10, $listenerKeys);
- $config->replaceArgument(11, isset($firewall['switch_user']) ? $firewall['switch_user'] : null);
+ $config->replaceArgument(11, $firewall['switch_user'] ?? null);
return [$matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null];
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
index 643cb1c40d..e677907eeb 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php
@@ -61,9 +61,9 @@ abstract class AbstractWebTestCase extends BaseWebTestCase
return new $class(
static::getVarDir(),
$options['test_case'],
- isset($options['root_config']) ? $options['root_config'] : 'config.yml',
- isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
- isset($options['debug']) ? $options['debug'] : false
+ $options['root_config'] ?? 'config.yml',
+ $options['environment'] ?? strtolower(static::getVarDir().$options['test_case']),
+ $options['debug'] ?? false
);
}
diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
index 50e107d2d5..a5127a25d8 100644
--- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
+++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
@@ -67,7 +67,7 @@ class ExceptionController
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
[
'status_code' => $code,
- 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
+ 'status_text' => Response::$statusTexts[$code] ?? '',
'exception' => $exception,
'logger' => $logger,
'currentContent' => $currentContent,
diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php
index bd0c606a86..9b1345d4c3 100644
--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php
+++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php
@@ -33,7 +33,7 @@ class TwigLoaderPass implements CompilerPassInterface
$found = 0;
foreach ($container->findTaggedServiceIds('twig.loader', true) as $id => $attributes) {
- $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
+ $priority = $attributes[0]['priority'] ?? 0;
$prioritizedLoaders[$priority][] = $id;
++$found;
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
index 28b0e2aa57..ac65e506f6 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
@@ -403,8 +403,8 @@ class ProfilerController
$nonces = $this->cspHandler ? $this->cspHandler->getNonces($request, $response) : [];
- $variables['csp_script_nonce'] = isset($nonces['csp_script_nonce']) ? $nonces['csp_script_nonce'] : null;
- $variables['csp_style_nonce'] = isset($nonces['csp_style_nonce']) ? $nonces['csp_style_nonce'] : null;
+ $variables['csp_script_nonce'] = $nonces['csp_script_nonce'] ?? null;
+ $variables['csp_style_nonce'] = $nonces['csp_style_nonce'] ?? null;
$response->setContent($this->twig->render($template, $variables));
diff --git a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
index c89ad0a14c..7f41db3052 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
@@ -126,8 +126,8 @@ class WebDebugToolbarListener implements EventSubscriberInterface
'excluded_ajax_paths' => $this->excludedAjaxPaths,
'token' => $response->headers->get('X-Debug-Token'),
'request' => $request,
- 'csp_script_nonce' => isset($nonces['csp_script_nonce']) ? $nonces['csp_script_nonce'] : null,
- 'csp_style_nonce' => isset($nonces['csp_style_nonce']) ? $nonces['csp_style_nonce'] : null,
+ 'csp_script_nonce' => $nonces['csp_script_nonce'] ?? null,
+ 'csp_style_nonce' => $nonces['csp_style_nonce'] ?? null,
]
))."\n";
$content = substr($content, 0, $pos).$toolbar.substr($content, $pos);
diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/router.php b/src/Symfony/Bundle/WebServerBundle/Resources/router.php
index ae2fa298c5..82212df103 100644
--- a/src/Symfony/Bundle/WebServerBundle/Resources/router.php
+++ b/src/Symfony/Bundle/WebServerBundle/Resources/router.php
@@ -30,7 +30,7 @@ if (is_file($_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME
return false;
}
-$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php';
+$script = $_ENV['APP_FRONT_CONTROLLER'] ?? 'index.php';
$_SERVER = array_merge($_SERVER, $_ENV);
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$script;
diff --git a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
index 957ab41733..72688a4926 100644
--- a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
+++ b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
@@ -63,6 +63,6 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
}
}
- return isset($this->manifestData[$path]) ? $this->manifestData[$path] : null;
+ return $this->manifestData[$path] ?? null;
}
}
diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php
index ce6e34ea16..7e95ebc448 100644
--- a/src/Symfony/Component/BrowserKit/Client.php
+++ b/src/Symfony/Component/BrowserKit/Client.php
@@ -157,7 +157,7 @@ abstract class Client
*/
public function getServerParameter($key, $default = '')
{
- return isset($this->server[$key]) ? $this->server[$key] : $default;
+ return $this->server[$key] ?? $default;
}
public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler
@@ -671,7 +671,7 @@ abstract class Client
} else {
$currentUri = sprintf('http%s://%s/',
isset($this->server['HTTPS']) ? 's' : '',
- isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost'
+ $this->server['HTTP_HOST'] ?? 'localhost'
);
}
diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
index b84d9f0370..39d9afd0e0 100644
--- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
@@ -152,7 +152,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
$missing = [];
$misses = [];
$nextAdapterIndex = $adapterIndex + 1;
- $nextAdapter = isset($this->adapters[$nextAdapterIndex]) ? $this->adapters[$nextAdapterIndex] : null;
+ $nextAdapter = $this->adapters[$nextAdapterIndex] ?? null;
foreach ($items as $k => $item) {
if (!$nextAdapter || $item->isHit()) {
diff --git a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
index 6e7bb18212..ed20bd2308 100644
--- a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
@@ -280,7 +280,7 @@ EOLUA;
foreach ($this->getHosts() as $host) {
$info = $host->info('Memory');
- $info = isset($info['Memory']) ? $info['Memory'] : $info;
+ $info = $info['Memory'] ?? $info;
return $this->redisEvictionPolicy = $info['maxmemory_policy'];
}
diff --git a/src/Symfony/Component/Cache/Simple/ChainCache.php b/src/Symfony/Component/Cache/Simple/ChainCache.php
index f2bb444915..bae9507260 100644
--- a/src/Symfony/Component/Cache/Simple/ChainCache.php
+++ b/src/Symfony/Component/Cache/Simple/ChainCache.php
@@ -96,7 +96,7 @@ class ChainCache implements Psr16CacheInterface, PruneableInterface, ResettableI
{
$missing = [];
$nextCacheIndex = $cacheIndex + 1;
- $nextCache = isset($this->caches[$nextCacheIndex]) ? $this->caches[$nextCacheIndex] : null;
+ $nextCache = $this->caches[$nextCacheIndex] ?? null;
foreach ($values as $k => $value) {
if ($miss !== $value) {
diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
index 34b8aa73a5..7b61e73a44 100644
--- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
+++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
@@ -151,7 +151,7 @@ trait MemcachedTrait
$params['path'] = substr($params['path'], 0, -\strlen($m[0]));
}
$params += [
- 'host' => isset($params['host']) ? $params['host'] : $params['path'],
+ 'host' => $params['host'] ?? $params['path'],
'port' => isset($params['host']) ? 11211 : null,
'weight' => 0,
];
diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php
index 9aae74661d..e115acfb89 100644
--- a/src/Symfony/Component/Cache/Traits/PdoTrait.php
+++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php
@@ -62,14 +62,14 @@ trait PdoTrait
throw new InvalidArgumentException(sprintf('"%s" requires PDO or Doctrine\DBAL\Connection instance or DSN string as first argument, "%s" given.', __CLASS__, \is_object($connOrDsn) ? \get_class($connOrDsn) : \gettype($connOrDsn)));
}
- $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table;
- $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
- $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
- $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
- $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
- $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
- $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password;
- $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions;
+ $this->table = $options['db_table'] ?? $this->table;
+ $this->idCol = $options['db_id_col'] ?? $this->idCol;
+ $this->dataCol = $options['db_data_col'] ?? $this->dataCol;
+ $this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol;
+ $this->timeCol = $options['db_time_col'] ?? $this->timeCol;
+ $this->username = $options['db_username'] ?? $this->username;
+ $this->password = $options['db_password'] ?? $this->password;
+ $this->connectionOptions = $options['db_connection_options'] ?? $this->connectionOptions;
$this->namespace = $namespace;
$this->marshaller = $marshaller ?? new DefaultMarshaller();
diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php
index 5986c075bb..d48dd24b57 100644
--- a/src/Symfony/Component/Cache/Traits/RedisTrait.php
+++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php
@@ -356,7 +356,7 @@ trait RedisTrait
}
$info = $host->info('Server');
- $info = isset($info['Server']) ? $info['Server'] : $info;
+ $info = $info['Server'] ?? $info;
if (!version_compare($info['redis_version'], '2.8', '>=')) {
// As documented in Redis documentation (http://redis.io/commands/keys) using KEYS
diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php
index b2cc93395a..3b0ea0a98a 100644
--- a/src/Symfony/Component/Config/Definition/BaseNode.php
+++ b/src/Symfony/Component/Config/Definition/BaseNode.php
@@ -112,7 +112,7 @@ abstract class BaseNode implements NodeInterface
*/
public function getAttribute($key, $default = null)
{
- return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
+ return $this->attributes[$key] ?? $default;
}
/**
diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
index 60491e0da3..bec08b0db6 100644
--- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
@@ -281,7 +281,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
->beforeNormalization()
->ifArray()
->then(function ($v) {
- $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
+ $v['enabled'] = $v['enabled'] ?? true;
return $v;
})
diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
index f48414e318..7f52b57997 100644
--- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
+++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
@@ -367,7 +367,7 @@ class PrototypedArrayNode extends ArrayNode
*/
private function getPrototypeForChild(string $key)
{
- $prototype = isset($this->valuePrototypes[$key]) ? $this->valuePrototypes[$key] : $this->prototype;
+ $prototype = $this->valuePrototypes[$key] ?? $this->prototype;
$prototype->setName($key);
return $prototype;
diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php
index c5988d2303..1ca59665a4 100644
--- a/src/Symfony/Component/Config/Loader/FileLoader.php
+++ b/src/Symfony/Component/Config/Loader/FileLoader.php
@@ -97,7 +97,7 @@ abstract class FileLoader extends Loader
}
if ($isSubpath) {
- return isset($ret[1]) ? $ret : (isset($ret[0]) ? $ret[0] : null);
+ return isset($ret[1]) ? $ret : ($ret[0] ?? null);
}
}
diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
index da76a7b780..e1a9b6208b 100644
--- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
@@ -219,8 +219,8 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
}
$props = [
- 'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
- 'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
+ 'file' => $callerFrame['file'] ?? null,
+ 'line' => $callerFrame['line'] ?? null,
'trace' => \array_slice($trace, 1 + $i),
];
diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php
index bc3f23b5e4..e71a16d109 100644
--- a/src/Symfony/Component/Console/Application.php
+++ b/src/Symfony/Component/Console/Application.php
@@ -925,11 +925,11 @@ class Application implements ResetInterface
]);
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
- $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
- $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
- $function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
- $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
- $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
+ $class = $trace[$i]['class'] ?? '';
+ $type = $trace[$i]['type'] ?? '';
+ $function = $trace[$i]['function'] ?? '';
+ $file = $trace[$i]['file'] ?? 'n/a';
+ $line = $trace[$i]['line'] ?? 'n/a';
$output->writeln(sprintf(' %s%s at %s:%s', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
}
diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
index 3192c0f6f2..3970b90007 100644
--- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
+++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
@@ -80,7 +80,7 @@ class ApplicationDescription
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
}
- return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
+ return $this->commands[$name] ?? $this->aliases[$name];
}
private function inspectApplication()
diff --git a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
index 5ba588ee98..4c09e12676 100644
--- a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
@@ -63,7 +63,7 @@ class JsonDescriptor extends Descriptor
*/
protected function describeApplication(Application $application, array $options = [])
{
- $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
+ $describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace, true);
$commands = [];
@@ -95,7 +95,7 @@ class JsonDescriptor extends Descriptor
*/
private function writeData(array $data, array $options)
{
- $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
+ $flags = $options['json_encoding'] ?? 0;
$this->write(json_encode($data, $flags));
}
diff --git a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php
index 02b8c30125..9a9d280751 100644
--- a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php
@@ -143,7 +143,7 @@ class MarkdownDescriptor extends Descriptor
*/
protected function describeApplication(Application $application, array $options = [])
{
- $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
+ $describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace);
$title = $this->getApplicationTitle($application);
diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
index 05a32443d9..1db3686be4 100644
--- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
@@ -39,7 +39,7 @@ class TextDescriptor extends Descriptor
$default = '';
}
- $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
+ $totalWidth = $options['total_width'] ?? Helper::strlen($argument->getName());
$spacingWidth = $totalWidth - \strlen($argument->getName());
$this->writeText(sprintf(' %s %s%s%s',
@@ -71,7 +71,7 @@ class TextDescriptor extends Descriptor
}
}
- $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]);
+ $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
$synopsis = sprintf('%s%s',
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
sprintf('--%s%s', $option->getName(), $value)
@@ -176,7 +176,7 @@ class TextDescriptor extends Descriptor
*/
protected function describeApplication(Application $application, array $options = [])
{
- $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
+ $describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace);
if (isset($options['raw_text']) && $options['raw_text']) {
diff --git a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
index 3d5dce1d6a..a6288d44f9 100644
--- a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
@@ -152,7 +152,7 @@ class XmlDescriptor extends Descriptor
*/
protected function describeApplication(Application $application, array $options = [])
{
- $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
+ $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null));
}
/**
diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php
index 26288ce62f..fa4189d047 100644
--- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php
+++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php
@@ -163,7 +163,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
if ($open = '/' != $text[1]) {
$tag = $matches[1][$i][0];
} else {
- $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
+ $tag = $matches[3][$i][0] ?? '';
}
if (!$open && !$tag) {
diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php
index afabf7c52f..4690cffbdc 100644
--- a/src/Symfony/Component/Console/Helper/ProgressBar.php
+++ b/src/Symfony/Component/Console/Helper/ProgressBar.php
@@ -110,7 +110,7 @@ final class ProgressBar
self::$formatters = self::initPlaceholderFormatters();
}
- return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
+ return self::$formatters[$name] ?? null;
}
/**
@@ -143,7 +143,7 @@ final class ProgressBar
self::$formats = self::initFormats();
}
- return isset(self::$formats[$name]) ? self::$formats[$name] : null;
+ return self::$formats[$name] ?? null;
}
/**
diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php
index 04db8f7c16..c189ba8044 100644
--- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php
+++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php
@@ -149,7 +149,7 @@ class ProgressIndicator
self::$formats = self::initFormats();
}
- return isset(self::$formats[$name]) ? self::$formats[$name] : null;
+ return self::$formats[$name] ?? null;
}
/**
@@ -182,7 +182,7 @@ class ProgressIndicator
self::$formatters = self::initPlaceholderFormatters();
}
- return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
+ return self::$formatters[$name] ?? null;
}
private function display()
diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php
index 18a222db38..e7ea005559 100644
--- a/src/Symfony/Component/Console/Helper/QuestionHelper.php
+++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php
@@ -170,13 +170,13 @@ class QuestionHelper extends Helper
$choices = $question->getChoices();
if (!$question->isMultiselect()) {
- return isset($choices[$default]) ? $choices[$default] : $default;
+ return $choices[$default] ?? $default;
}
$default = explode(',', $default);
foreach ($default as $k => $v) {
$v = $question->isTrimmable() ? trim($v) : $v;
- $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
+ $default[$k] = $choices[$v] ?? $v;
}
}
diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php
index e4e87b2f99..ace5e1868e 100644
--- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php
+++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php
@@ -58,7 +58,7 @@ class SymfonyQuestionHelper extends QuestionHelper
case $question instanceof ChoiceQuestion:
$choices = $question->getChoices();
- $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
+ $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
break;
diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index facffa683f..e7a9b6ccbb 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -503,7 +503,7 @@ class Table
*/
private function renderCell(array $row, int $column, string $cellFormat): string
{
- $cell = isset($row[$column]) ? $row[$column] : '';
+ $cell = $row[$column] ?? '';
$width = $this->effectiveColumnWidths[$column];
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
// add the width of the following columns(numbers of colspan).
@@ -637,7 +637,7 @@ class Table
// create a two dimensional array (rowspan x colspan)
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
- $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
+ $value = $lines[$unmergedRowKey - $line] ?? '';
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]);
if ($nbLines === $unmergedRowKey - $line) {
break;
@@ -775,7 +775,7 @@ class Table
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
}
- $columnWidth = isset($this->columnWidths[$column]) ? $this->columnWidths[$column] : 0;
+ $columnWidth = $this->columnWidths[$column] ?? 0;
$cellWidth = max($cellWidth, $columnWidth);
return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php
index c1220316dc..6e4c01e95f 100644
--- a/src/Symfony/Component/Console/Input/Input.php
+++ b/src/Symfony/Component/Console/Input/Input.php
@@ -110,7 +110,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
- return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
+ return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
}
/**
diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php
index b247b357d5..2056f04c99 100644
--- a/src/Symfony/Component/Console/Style/SymfonyStyle.php
+++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php
@@ -295,7 +295,7 @@ class SymfonyStyle extends OutputStyle
{
if (null !== $default) {
$values = array_flip($choices);
- $default = isset($values[$default]) ? $values[$default] : $default;
+ $default = $values[$default] ?? $default;
}
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
diff --git a/src/Symfony/Component/Console/Tester/TesterTrait.php b/src/Symfony/Component/Console/Tester/TesterTrait.php
index 14b65ec000..27d5985590 100644
--- a/src/Symfony/Component/Console/Tester/TesterTrait.php
+++ b/src/Symfony/Component/Console/Tester/TesterTrait.php
@@ -141,8 +141,8 @@ trait TesterTrait
}
} else {
$this->output = new ConsoleOutput(
- isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL,
- isset($options['decorated']) ? $options['decorated'] : null
+ $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
+ $options['decorated'] ?? null
);
$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
diff --git a/src/Symfony/Component/CssSelector/Parser/Parser.php b/src/Symfony/Component/CssSelector/Parser/Parser.php
index a03f1527f1..63e883dcfa 100644
--- a/src/Symfony/Component/CssSelector/Parser/Parser.php
+++ b/src/Symfony/Component/CssSelector/Parser/Parser.php
@@ -84,7 +84,7 @@ class Parser implements ParserInterface
}
$split = explode('n', $joined);
- $first = isset($split[0]) ? $split[0] : null;
+ $first = $split[0] ?? null;
return [
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php
index 6d562c5f56..6da37ff552 100644
--- a/src/Symfony/Component/Debug/ErrorHandler.php
+++ b/src/Symfony/Component/Debug/ErrorHandler.php
@@ -636,7 +636,7 @@ class ErrorHandler
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
// Let's not throw anymore but keep logging
$handler->throwAt(0, true);
- $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
+ $trace = $error['backtrace'] ?? null;
if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
$exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php
index b48769a2a3..8e877b0e03 100644
--- a/src/Symfony/Component/Debug/Exception/FlattenException.php
+++ b/src/Symfony/Component/Debug/Exception/FlattenException.php
@@ -281,11 +281,11 @@ class FlattenException
$this->trace[] = [
'namespace' => $namespace,
'short_class' => $class,
- 'class' => isset($entry['class']) ? $entry['class'] : '',
- 'type' => isset($entry['type']) ? $entry['type'] : '',
- 'function' => isset($entry['function']) ? $entry['function'] : null,
- 'file' => isset($entry['file']) ? $entry['file'] : null,
- 'line' => isset($entry['line']) ? $entry['line'] : null,
+ 'class' => $entry['class'] ?? '',
+ 'type' => $entry['type'] ?? '',
+ 'function' => $entry['function'] ?? null,
+ 'file' => $entry['file'] ?? null,
+ 'line' => $entry['line'] ?? null,
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
];
}
diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php
index 708e9d4ebd..349b2ed5ab 100644
--- a/src/Symfony/Component/DependencyInjection/Definition.php
+++ b/src/Symfony/Component/DependencyInjection/Definition.php
@@ -506,7 +506,7 @@ class Definition
*/
public function getTag($name)
{
- return isset($this->tags[$name]) ? $this->tags[$name] : [];
+ return $this->tags[$name] ?? [];
}
/**
diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
index 1d3bd4f47f..0be733e9ef 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -508,7 +508,7 @@ class YamlFileLoader extends FileLoader
}
}
- $tags = isset($service['tags']) ? $service['tags'] : [];
+ $tags = $service['tags'] ?? [];
if (!\is_array($tags)) {
throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file));
}
@@ -559,8 +559,8 @@ class YamlFileLoader extends FileLoader
throw new InvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean "exception", "ignore" or null in "%s"?', $decorationOnInvalid, $id, $file));
}
- $renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null;
- $priority = isset($service['decoration_priority']) ? $service['decoration_priority'] : 0;
+ $renameId = $service['decoration_inner_name'] ?? null;
+ $priority = $service['decoration_priority'] ?? 0;
$definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior);
}
@@ -606,8 +606,8 @@ class YamlFileLoader extends FileLoader
if (!\is_string($service['resource'])) {
throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file));
}
- $exclude = isset($service['exclude']) ? $service['exclude'] : null;
- $namespace = isset($service['namespace']) ? $service['namespace'] : $id;
+ $exclude = $service['exclude'] ?? null;
+ $namespace = $service['namespace'] ?? $id;
$this->registerClasses($definition, $namespace, $service['resource'], $exclude);
} else {
$this->setDefinition($id, $definition);
@@ -789,7 +789,7 @@ class YamlFileLoader extends FileLoader
$instanceof = $this->instanceof;
$this->instanceof = [];
- $id = sprintf('.%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '').$this->anonymousServicesSuffix);
+ $id = sprintf('.%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', $argument['class'] ?? '').$this->anonymousServicesSuffix);
$this->parseDefinition($id, $argument, $file, []);
if (!$this->container->hasDefinition($id)) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php
index c9fb65ddee..8f150e1d32 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php
@@ -17,10 +17,10 @@ class ProjectExtension implements ExtensionInterface
}
$configuration->register('project.service.bar', 'FooClass')->setPublic(true);
- $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar');
+ $configuration->setParameter('project.parameter.bar', $config['foo'] ?? 'foobar');
$configuration->register('project.service.foo', 'FooClass')->setPublic(true);
- $configuration->setParameter('project.parameter.foo', isset($config['foo']) ? $config['foo'] : 'foobar');
+ $configuration->setParameter('project.parameter.foo', $config['foo'] ?? 'foobar');
return $configuration;
}
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index ae7369b4ec..8f12764474 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -1134,7 +1134,7 @@ class Crawler implements \Countable, \IteratorAggregate
*/
public function getNode($position)
{
- return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
+ return $this->nodes[$position] ?? null;
}
/**
diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php
index 03596a57e6..57128b4ec7 100644
--- a/src/Symfony/Component/Dotenv/Dotenv.php
+++ b/src/Symfony/Component/Dotenv/Dotenv.php
@@ -257,7 +257,7 @@ final class Dotenv
throw $this->createFormatException('Whitespace are not supported before the value');
}
- $loadedVars = array_flip(explode(',', isset($_SERVER['SYMFONY_DOTENV_VARS']) ? $_SERVER['SYMFONY_DOTENV_VARS'] : (isset($_ENV['SYMFONY_DOTENV_VARS']) ? $_ENV['SYMFONY_DOTENV_VARS'] : '')));
+ $loadedVars = array_flip(explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? ($_ENV['SYMFONY_DOTENV_VARS'] ?? '')));
unset($loadedVars['']);
$v = '';
diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
index 412110e7a5..5b5ab34433 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
@@ -659,7 +659,7 @@ class ErrorHandler
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
// Let's not throw anymore but keep logging
$handler->throwAt(0, true);
- $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
+ $trace = $error['backtrace'] ?? null;
if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
$fatalError = new OutOfMemoryError($handler->levels[$error['type']].': '.$error['message'], 0, $error, 2, false, $trace);
diff --git a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
index 0a40aafcd3..0dcd72673e 100644
--- a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
+++ b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
@@ -309,11 +309,11 @@ class FlattenException extends LegacyFlattenException
$this->trace[] = [
'namespace' => $namespace,
'short_class' => $class,
- 'class' => isset($entry['class']) ? $entry['class'] : '',
- 'type' => isset($entry['type']) ? $entry['type'] : '',
- 'function' => isset($entry['function']) ? $entry['function'] : null,
- 'file' => isset($entry['file']) ? $entry['file'] : null,
- 'line' => isset($entry['line']) ? $entry['line'] : null,
+ 'class' => $entry['class'] ?? '',
+ 'type' => $entry['type'] ?? '',
+ 'function' => $entry['function'] ?? null,
+ 'file' => $entry['file'] ?? null,
+ 'line' => $entry['line'] ?? null,
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
];
}
diff --git a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
index 4b27d3b23a..1a52c3e865 100644
--- a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
+++ b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
@@ -66,7 +66,7 @@ class RegisterListenersPass implements CompilerPassInterface
foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) {
foreach ($events as $event) {
- $priority = isset($event['priority']) ? $event['priority'] : 0;
+ $priority = $event['priority'] ?? 0;
if (!isset($event['event'])) {
if ($container->getDefinition($id)->hasTag($this->subscriberTag)) {
diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
index d22bcea1f8..8b62227189 100644
--- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
@@ -198,10 +198,10 @@ class EventDispatcher implements EventDispatcherInterface
if (\is_string($params)) {
$this->addListener($eventName, [$subscriber, $params]);
} elseif (\is_string($params[0])) {
- $this->addListener($eventName, [$subscriber, $params[0]], isset($params[1]) ? $params[1] : 0);
+ $this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0);
} else {
foreach ($params as $listener) {
- $this->addListener($eventName, [$subscriber, $listener[0]], isset($listener[1]) ? $listener[1] : 0);
+ $this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0);
}
}
}
diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php
index e20972caee..4053d9e6a5 100644
--- a/src/Symfony/Component/Filesystem/Filesystem.php
+++ b/src/Symfony/Component/Filesystem/Filesystem.php
@@ -577,7 +577,7 @@ class Filesystem
} elseif (is_dir($file)) {
$this->mkdir($target);
} elseif (is_file($file)) {
- $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
+ $this->copy($file, $target, $options['override'] ?? false);
} else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
}
diff --git a/src/Symfony/Component/Finder/Comparator/DateComparator.php b/src/Symfony/Component/Finder/Comparator/DateComparator.php
index d17c77a9d3..ae22c6cbec 100644
--- a/src/Symfony/Component/Finder/Comparator/DateComparator.php
+++ b/src/Symfony/Component/Finder/Comparator/DateComparator.php
@@ -36,7 +36,7 @@ class DateComparator extends Comparator
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
}
- $operator = isset($matches[1]) ? $matches[1] : '==';
+ $operator = $matches[1] ?? '==';
if ('since' === $operator || 'after' === $operator) {
$operator = '>';
}
diff --git a/src/Symfony/Component/Finder/Comparator/NumberComparator.php b/src/Symfony/Component/Finder/Comparator/NumberComparator.php
index 80667c9ddd..78e1bd3b34 100644
--- a/src/Symfony/Component/Finder/Comparator/NumberComparator.php
+++ b/src/Symfony/Component/Finder/Comparator/NumberComparator.php
@@ -74,6 +74,6 @@ class NumberComparator extends Comparator
}
$this->setTarget($target);
- $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
+ $this->setOperator($matches[1] ?? '==');
}
}
diff --git a/src/Symfony/Component/Form/AbstractExtension.php b/src/Symfony/Component/Form/AbstractExtension.php
index 5009cbecc4..3e82f7a451 100644
--- a/src/Symfony/Component/Form/AbstractExtension.php
+++ b/src/Symfony/Component/Form/AbstractExtension.php
@@ -84,9 +84,8 @@ abstract class AbstractExtension implements FormExtensionInterface
$this->initTypeExtensions();
}
- return isset($this->typeExtensions[$name])
- ? $this->typeExtensions[$name]
- : [];
+ return $this->typeExtensions[$name]
+ ?? [];
}
/**
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
index e401351660..07564fd65d 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
@@ -162,7 +162,7 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
$label,
// The attributes may be a callable or a mapping from choice indices
// to nested arrays
- \is_callable($attr) ? $attr($choice, $key, $value) : (isset($attr[$key]) ? $attr[$key] : [])
+ \is_callable($attr) ? $attr($choice, $key, $value) : ($attr[$key] ?? [])
);
// $isPreferred may be null if no choices are preferred
diff --git a/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php
index 977ca7af46..16845b4d0a 100644
--- a/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php
@@ -94,7 +94,7 @@ class JsonDescriptor extends Descriptor
private function writeData(array $data, array $options)
{
- $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
+ $flags = $options['json_encoding'] ?? 0;
$this->output->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php b/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
index b1605b50dc..8ce09ca4a4 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
@@ -31,7 +31,7 @@ class CheckboxType extends AbstractType
// transformer handles this case).
// We cannot solve this case via overriding the "data" option, because
// doing so also calls setDataLocked(true).
- $builder->setData(isset($options['data']) ? $options['data'] : false);
+ $builder->setData($options['data'] ?? false);
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
$builder->setAttribute('_false_is_empty', true); // @internal - A boolean flag to treat false as empty, see Form::isEmpty() - Do not rely on it, it will be removed in Symfony 5.1.
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php
index 2c41b1c6a3..981740fdaa 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php
@@ -105,7 +105,7 @@ class DateIntervalType extends AbstractType
'required' => $options['required'],
'translation_domain' => $options['translation_domain'],
// when compound the array entries are ignored, we need to cascade the configuration here
- 'empty_data' => isset($options['empty_data'][$part]) ? $options['empty_data'][$part] : null,
+ 'empty_data' => $options['empty_data'][$part] ?? null,
];
if ('choice' === $options['widget']) {
$childOptions['choice_translation_domain'] = false;
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
index 7989115074..e542351a02 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
@@ -114,7 +114,7 @@ class DateTimeType extends AbstractType
return static function (FormInterface $form) use ($emptyData, $option) {
$emptyData = $emptyData($form->getParent());
- return isset($emptyData[$option]) ? $emptyData[$option] : '';
+ return $emptyData[$option] ?? '';
};
};
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
index 546331a1b8..e446151d2a 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
@@ -88,7 +88,7 @@ class DateType extends AbstractType
return static function (FormInterface $form) use ($emptyData, $option) {
$emptyData = $emptyData($form->getParent());
- return isset($emptyData[$option]) ? $emptyData[$option] : '';
+ return $emptyData[$option] ?? '';
};
};
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
index ae8d4e3bf0..d2f1a4e096 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
@@ -66,7 +66,7 @@ class TimeType extends AbstractType
if ($options['with_seconds']) {
// handle seconds ignored by user's browser when with_seconds enabled
// https://codereview.chromium.org/450533009/
- $e->setData(sprintf('%s:%s:%s', $matches['hours'], $matches['minutes'], isset($matches['seconds']) ? $matches['seconds'] : '00'));
+ $e->setData(sprintf('%s:%s:%s', $matches['hours'], $matches['minutes'], $matches['seconds'] ?? '00'));
} else {
$e->setData(sprintf('%s:%s', $matches['hours'], $matches['minutes']));
}
@@ -100,7 +100,7 @@ class TimeType extends AbstractType
return static function (FormInterface $form) use ($emptyData, $option) {
$emptyData = $emptyData($form->getParent());
- return isset($emptyData[$option]) ? $emptyData[$option] : '';
+ return $emptyData[$option] ?? '';
};
};
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
index a342ba5fcb..005683ec89 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
@@ -290,9 +290,8 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
$hash = spl_object_hash($form);
$output = &$outputByHash[$hash];
- $output = isset($this->dataByForm[$hash])
- ? $this->dataByForm[$hash]
- : [];
+ $output = $this->dataByForm[$hash]
+ ?? [];
$output['children'] = [];
@@ -320,16 +319,14 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
$output = &$outputByHash[$formHash];
}
- $output = isset($this->dataByView[$viewHash])
- ? $this->dataByView[$viewHash]
- : [];
+ $output = $this->dataByView[$viewHash]
+ ?? [];
if (null !== $formHash) {
$output = array_replace(
$output,
- isset($this->dataByForm[$formHash])
- ? $this->dataByForm[$formHash]
- : []
+ $this->dataByForm[$formHash]
+ ?? []
);
}
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php
index dce0053f0a..9cecc720e3 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php
@@ -138,8 +138,8 @@ class FormDataExtractor implements FormDataExtractorInterface
public function extractViewVariables(FormView $view)
{
$data = [
- 'id' => isset($view->vars['id']) ? $view->vars['id'] : null,
- 'name' => isset($view->vars['name']) ? $view->vars['name'] : null,
+ 'id' => $view->vars['id'] ?? null,
+ 'name' => $view->vars['name'] ?? null,
'view_vars' => [],
];
diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
index 78be91c8b8..c725b69dd4 100644
--- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
+++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
@@ -64,7 +64,7 @@ class MappingRule
{
$length = \strlen($propertyPath);
$prefix = substr($this->propertyPath, 0, $length);
- $next = isset($this->propertyPath[$length]) ? $this->propertyPath[$length] : null;
+ $next = $this->propertyPath[$length] ?? null;
return $prefix === $propertyPath && ('[' === $next || '.' === $next);
}
diff --git a/src/Symfony/Component/Form/FormFactoryBuilder.php b/src/Symfony/Component/Form/FormFactoryBuilder.php
index f7644bb1f6..64ce909e66 100644
--- a/src/Symfony/Component/Form/FormFactoryBuilder.php
+++ b/src/Symfony/Component/Form/FormFactoryBuilder.php
@@ -178,7 +178,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
if (\count($this->typeGuessers) > 1) {
$typeGuesser = new FormTypeGuesserChain($this->typeGuessers);
} else {
- $typeGuesser = isset($this->typeGuessers[0]) ? $this->typeGuessers[0] : null;
+ $typeGuesser = $this->typeGuessers[0] ?? null;
}
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
diff --git a/src/Symfony/Component/Form/PreloadedExtension.php b/src/Symfony/Component/Form/PreloadedExtension.php
index d9132e0515..887389ed80 100644
--- a/src/Symfony/Component/Form/PreloadedExtension.php
+++ b/src/Symfony/Component/Form/PreloadedExtension.php
@@ -73,9 +73,8 @@ class PreloadedExtension implements FormExtensionInterface
*/
public function getTypeExtensions($name)
{
- return isset($this->typeExtensions[$name])
- ? $this->typeExtensions[$name]
- : [];
+ return $this->typeExtensions[$name]
+ ?? [];
}
/**
diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php
index 0206e3db2b..d913d34eb3 100644
--- a/src/Symfony/Component/Form/ResolvedFormType.php
+++ b/src/Symfony/Component/Form/ResolvedFormType.php
@@ -100,7 +100,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
}
// Should be decoupled from the specific option at some point
- $dataClass = isset($options['data_class']) ? $options['data_class'] : null;
+ $dataClass = $options['data_class'] ?? null;
$builder = $this->newBuilder($name, $dataClass, $factory, $options);
$builder->setType($this);
diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
index db3dcb9f3f..1bb46d8f50 100644
--- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
+++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php
@@ -51,7 +51,7 @@ class CallbackChoiceLoaderTest extends TestCase
return self::$choices;
});
self::$value = function ($choice) {
- return isset($choice->value) ? $choice->value : null;
+ return $choice->value ?? null;
};
self::$choices = [
(object) ['value' => 'choice_one'],
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
index 8c71b7bfac..5e10aad7ad 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
@@ -78,7 +78,7 @@ class ViolationMapperTest extends TestCase
$config = new FormConfigBuilder($name, $dataClass, $this->dispatcher, [
'error_mapping' => $errorMapping,
] + $options);
- $config->setMapped(isset($options['mapped']) ? $options['mapped'] : true);
+ $config->setMapped($options['mapped'] ?? true);
$config->setInheritData($inheritData);
$config->setPropertyPath($propertyPath);
$config->setCompound(true);
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
index 335e5c4c7e..3f7c4005fe 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
@@ -36,7 +36,7 @@ class TestExtension implements FormExtensionInterface
public function getType($name): FormTypeInterface
{
- return isset($this->types[$name]) ? $this->types[$name] : null;
+ return $this->types[$name] ?? null;
}
public function hasType($name): bool
@@ -57,7 +57,7 @@ class TestExtension implements FormExtensionInterface
public function getTypeExtensions($name): array
{
- return isset($this->extensions[$name]) ? $this->extensions[$name] : [];
+ return $this->extensions[$name] ?? [];
}
public function hasTypeExtensions($name): bool
diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php
index 954aac6014..7d01c8f5d6 100644
--- a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php
+++ b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php
@@ -157,7 +157,7 @@ class AcceptHeaderItem
*/
public function getAttribute($name, $default = null)
{
- return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
+ return $this->attributes[$name] ?? $default;
}
/**
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
index 2380919bca..bab96fa24f 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
@@ -821,6 +821,6 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
$lcMimeType = strtolower($mimeType);
- return isset($this->defaultExtensions[$lcMimeType]) ? $this->defaultExtensions[$lcMimeType] : null;
+ return $this->defaultExtensions[$lcMimeType] ?? null;
}
}
diff --git a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
index e0b068a5dc..682bdff741 100644
--- a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
+++ b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
@@ -301,7 +301,7 @@ class UploadedFile extends File
$errorCode = $this->error;
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
- $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
+ $message = $errors[$errorCode] ?? 'The file "%s" was not uploaded due to an unknown error.';
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
}
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 1f89b2db3c..36506fdd06 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -1301,7 +1301,7 @@ class Request
static::initializeFormats();
}
- return isset(static::$formats[$format]) ? static::$formats[$format] : [];
+ return static::$formats[$format] ?? [];
}
/**
@@ -1609,7 +1609,7 @@ class Request
$preferredLanguages = $this->getLanguages();
if (empty($locales)) {
- return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
+ return $preferredLanguages[0] ?? null;
}
if (!$preferredLanguages) {
@@ -1629,7 +1629,7 @@ class Request
$preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales));
- return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0];
+ return $preferredLanguages[0] ?? $locales[0];
}
/**
diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index 14c3652851..fb09d62c00 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -465,7 +465,7 @@ class Response
}
if (null === $text) {
- $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
+ $this->statusText = self::$statusTexts[$code] ?? 'unknown status';
return $this;
}
diff --git a/src/Symfony/Component/HttpFoundation/ServerBag.php b/src/Symfony/Component/HttpFoundation/ServerBag.php
index ed2d7812ac..5e1094d5fe 100644
--- a/src/Symfony/Component/HttpFoundation/ServerBag.php
+++ b/src/Symfony/Component/HttpFoundation/ServerBag.php
@@ -38,7 +38,7 @@ class ServerBag extends ParameterBag
if (isset($this->parameters['PHP_AUTH_USER'])) {
$headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER'];
- $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
+ $headers['PHP_AUTH_PW'] = $this->parameters['PHP_AUTH_PW'] ?? '';
} else {
/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
index 6711e0a55f..c8f1189909 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php
@@ -51,7 +51,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
}
$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
- $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
+ $this->prefix = $options['prefix'] ?? 'sf2s';
}
/**
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
index e579c4ab1b..db74187760 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -185,15 +185,15 @@ class PdoSessionHandler extends AbstractSessionHandler
$this->dsn = $pdoOrDsn;
}
- $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table;
- $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
- $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
- $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
- $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
- $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
- $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password;
- $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions;
- $this->lockMode = isset($options['lock_mode']) ? $options['lock_mode'] : $this->lockMode;
+ $this->table = $options['db_table'] ?? $this->table;
+ $this->idCol = $options['db_id_col'] ?? $this->idCol;
+ $this->dataCol = $options['db_data_col'] ?? $this->dataCol;
+ $this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol;
+ $this->timeCol = $options['db_time_col'] ?? $this->timeCol;
+ $this->username = $options['db_username'] ?? $this->username;
+ $this->password = $options['db_password'] ?? $this->password;
+ $this->connectionOptions = $options['db_connection_options'] ?? $this->connectionOptions;
+ $this->lockMode = $options['lock_mode'] ?? $this->lockMode;
}
/**
@@ -479,7 +479,7 @@ class PdoSessionHandler extends AbstractSessionHandler
'sqlite3' => 'sqlite',
];
- $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
+ $driver = $driverAliasMap[$params['scheme']] ?? $params['scheme'];
// Doctrine DBAL supports passing its internal pdo_* driver names directly too (allowing both dashes and underscores). This allows supporting the same here.
if (0 === strpos($driver, 'pdo_') || 0 === strpos($driver, 'pdo-')) {
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
index db8f85e75d..73ba349191 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
@@ -242,7 +242,7 @@ class MockArraySessionStorage implements SessionStorageInterface
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
- $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : [];
+ $this->data[$key] = $this->data[$key] ?? [];
$bag->initialize($this->data[$key]);
}
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
index f005f1d970..179c7515c7 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
@@ -219,7 +219,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function getPhpVersionExtra()
{
- return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
+ return $this->data['php_version_extra'] ?? null;
}
/**
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
index 07dd254d33..2797a347c8 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
@@ -81,32 +81,32 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
public function getLogs()
{
- return isset($this->data['logs']) ? $this->data['logs'] : [];
+ return $this->data['logs'] ?? [];
}
public function getPriorities()
{
- return isset($this->data['priorities']) ? $this->data['priorities'] : [];
+ return $this->data['priorities'] ?? [];
}
public function countErrors()
{
- return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
+ return $this->data['error_count'] ?? 0;
}
public function countDeprecations()
{
- return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;
+ return $this->data['deprecation_count'] ?? 0;
}
public function countWarnings()
{
- return isset($this->data['warning_count']) ? $this->data['warning_count'] : 0;
+ return $this->data['warning_count'] ?? 0;
}
public function countScreams()
{
- return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0;
+ return $this->data['scream_count'] ?? 0;
}
public function getCompilerLogs()
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
index 56bc6ec194..0e3c13ba06 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
@@ -88,7 +88,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
'format' => $request->getRequestFormat(),
'content' => $content,
'content_type' => $response->headers->get('Content-Type', 'text/html'),
- 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
+ 'status_text' => Response::$statusTexts[$statusCode] ?? '',
'status_code' => $statusCode,
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
@@ -339,12 +339,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
*/
public function getRedirect()
{
- return isset($this->data['redirect']) ? $this->data['redirect'] : false;
+ return $this->data['redirect'] ?? false;
}
public function getForwardToken()
{
- return isset($this->data['forward_token']) ? $this->data['forward_token'] : null;
+ return $this->data['forward_token'] ?? null;
}
/**
diff --git a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
index ee88debae4..0071979688 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
@@ -116,7 +116,7 @@ class RouterListener implements EventSubscriberInterface
if (null !== $this->logger) {
$this->logger->info('Matched route "{route}".', [
- 'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a',
+ 'route' => $parameters['_route'] ?? 'n/a',
'route_parameters' => $parameters,
'request_uri' => $request->getUri(),
'method' => $request->getMethod(),
diff --git a/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php
index f81199d883..06d8c380bd 100644
--- a/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php
+++ b/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php
@@ -71,12 +71,12 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
$uri = $this->generateSignedFragmentUri($uri, $request);
}
- $alt = isset($options['alt']) ? $options['alt'] : null;
+ $alt = $options['alt'] ?? null;
if ($alt instanceof ControllerReference) {
$alt = $this->generateSignedFragmentUri($alt, $request);
}
- $tag = $this->surrogate->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : '');
+ $tag = $this->surrogate->renderIncludeTag($uri, $alt, $options['ignore_errors'] ?? false, $options['comment'] ?? '');
return new Response($tag);
}
diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
index cca653342c..9004102f7e 100644
--- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
+++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
@@ -100,7 +100,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
$uri = str_replace('&', '&', $uri);
- $template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
+ $template = $options['default'] ?? $this->globalDefaultTemplate;
if (null !== $this->templating && $template && $this->templateExists($template)) {
$content = $this->templating->render($template);
} else {
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
index 3d461a7fe3..0bad63e748 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
@@ -97,7 +97,7 @@ class Esi extends AbstractSurrogate
$chunks[$i] = sprintf('surrogate->handle($this, %s, %s, %s) ?>'."\n",
var_export($options['src'], true),
- var_export(isset($options['alt']) ? $options['alt'] : '', true),
+ var_export($options['alt'] ?? '', true),
isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false'
);
++$i;
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
index 9536d78879..bfaaebe944 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php
@@ -277,8 +277,8 @@ class Store implements StoreInterface
foreach (preg_split('/[\s,]+/', $vary) as $header) {
$key = str_replace('_', '-', strtolower($header));
- $v1 = isset($env1[$key]) ? $env1[$key] : null;
- $v2 = isset($env2[$key]) ? $env2[$key] : null;
+ $v1 = $env1[$key] ?? null;
+ $v2 = $env2[$key] ?? null;
if ($v1 !== $v2) {
return false;
}
diff --git a/src/Symfony/Component/HttpKernel/Log/Logger.php b/src/Symfony/Component/HttpKernel/Log/Logger.php
index c97673dd89..0181817bdf 100644
--- a/src/Symfony/Component/HttpKernel/Log/Logger.php
+++ b/src/Symfony/Component/HttpKernel/Log/Logger.php
@@ -43,7 +43,7 @@ class Logger extends AbstractLogger
$minLevel = null === $output || 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::ERROR : LogLevel::WARNING;
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
- switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
+ switch ((int) ($_ENV['SHELL_VERBOSITY'] ?? $_SERVER['SHELL_VERBOSITY'])) {
case -1: $minLevel = LogLevel::ERROR; break;
case 1: $minLevel = LogLevel::NOTICE; break;
case 2: $minLevel = LogLevel::INFO; break;
diff --git a/src/Symfony/Component/HttpKernel/UriSigner.php b/src/Symfony/Component/HttpKernel/UriSigner.php
index a11a05f848..e4f988b265 100644
--- a/src/Symfony/Component/HttpKernel/UriSigner.php
+++ b/src/Symfony/Component/HttpKernel/UriSigner.php
@@ -93,12 +93,12 @@ class UriSigner
$url['query'] = http_build_query($params, '', '&');
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
- $host = isset($url['host']) ? $url['host'] : '';
+ $host = $url['host'] ?? '';
$port = isset($url['port']) ? ':'.$url['port'] : '';
- $user = isset($url['user']) ? $url['user'] : '';
+ $user = $url['user'] ?? '';
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
$pass = ($user || $pass) ? "$pass@" : '';
- $path = isset($url['path']) ? $url['path'] : '';
+ $path = $url['path'] ?? '';
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';
diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php
index 4e15eeed26..ff6d479261 100644
--- a/src/Symfony/Component/Intl/Collator/Collator.php
+++ b/src/Symfony/Component/Intl/Collator/Collator.php
@@ -114,7 +114,7 @@ abstract class Collator
self::SORT_STRING => \SORT_STRING,
];
- $plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR;
+ $plainSortFlag = $intlToPlainFlagMap[$sortFlag] ?? self::SORT_REGULAR;
return asort($array, $plainSortFlag);
}
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
index 2641528989..60e8fe978f 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
@@ -298,15 +298,15 @@ class FullTransformer
private function getDefaultValueForOptions(array $options): array
{
return [
- 'year' => isset($options['year']) ? $options['year'] : 1970,
- 'month' => isset($options['month']) ? $options['month'] : 1,
- 'day' => isset($options['day']) ? $options['day'] : 1,
- 'hour' => isset($options['hour']) ? $options['hour'] : 0,
- 'hourInstance' => isset($options['hourInstance']) ? $options['hourInstance'] : null,
- 'minute' => isset($options['minute']) ? $options['minute'] : 0,
- 'second' => isset($options['second']) ? $options['second'] : 0,
- 'marker' => isset($options['marker']) ? $options['marker'] : null,
- 'timezone' => isset($options['timezone']) ? $options['timezone'] : null,
+ 'year' => $options['year'] ?? 1970,
+ 'month' => $options['month'] ?? 1,
+ 'day' => $options['day'] ?? 1,
+ 'hour' => $options['hour'] ?? 0,
+ 'hourInstance' => $options['hourInstance'] ?? null,
+ 'minute' => $options['minute'] ?? 0,
+ 'second' => $options['second'] ?? 0,
+ 'marker' => $options['marker'] ?? null,
+ 'timezone' => $options['timezone'] ?? null,
];
}
}
diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
index b6cad37226..71447180cc 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -397,7 +397,7 @@ abstract class NumberFormatter
*/
public function getAttribute($attr)
{
- return isset($this->attributes[$attr]) ? $this->attributes[$attr] : null;
+ return $this->attributes[$attr] ?? null;
}
/**
diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php
index 5531a7c435..c14540c315 100644
--- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php
+++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php
@@ -101,7 +101,7 @@ class Collection implements CollectionInterface
{
$this->toArray();
- return isset($this->entries[$offset]) ? $this->entries[$offset] : null;
+ return $this->entries[$offset] ?? null;
}
public function offsetSet($offset, $value)
diff --git a/src/Symfony/Component/Ldap/Entry.php b/src/Symfony/Component/Ldap/Entry.php
index af0edbd1f3..1f2b0116e8 100644
--- a/src/Symfony/Component/Ldap/Entry.php
+++ b/src/Symfony/Component/Ldap/Entry.php
@@ -59,7 +59,7 @@ class Entry
*/
public function getAttribute($name)
{
- return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
+ return $this->attributes[$name] ?? null;
}
/**
diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php
index 5f8ba6d13a..e38e144d44 100644
--- a/src/Symfony/Component/Process/Process.php
+++ b/src/Symfony/Component/Process/Process.php
@@ -758,7 +758,7 @@ class Process implements \IteratorAggregate
return null;
}
- return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
+ return self::$exitCodes[$exitcode] ?? 'Unknown error';
}
/**
diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
index c7aa00e179..c72d588f73 100644
--- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
@@ -108,13 +108,13 @@ class YamlFileLoader extends FileLoader
*/
protected function parseRoute(RouteCollection $collection, $name, array $config, $path)
{
- $defaults = isset($config['defaults']) ? $config['defaults'] : [];
- $requirements = isset($config['requirements']) ? $config['requirements'] : [];
- $options = isset($config['options']) ? $config['options'] : [];
- $host = isset($config['host']) ? $config['host'] : '';
- $schemes = isset($config['schemes']) ? $config['schemes'] : [];
- $methods = isset($config['methods']) ? $config['methods'] : [];
- $condition = isset($config['condition']) ? $config['condition'] : null;
+ $defaults = $config['defaults'] ?? [];
+ $requirements = $config['requirements'] ?? [];
+ $options = $config['options'] ?? [];
+ $host = $config['host'] ?? '';
+ $schemes = $config['schemes'] ?? [];
+ $methods = $config['methods'] ?? [];
+ $condition = $config['condition'] ?? null;
foreach ($requirements as $placeholder => $requirement) {
if (\is_int($placeholder)) {
@@ -161,15 +161,15 @@ class YamlFileLoader extends FileLoader
*/
protected function parseImport(RouteCollection $collection, array $config, $path, $file)
{
- $type = isset($config['type']) ? $config['type'] : null;
- $prefix = isset($config['prefix']) ? $config['prefix'] : '';
- $defaults = isset($config['defaults']) ? $config['defaults'] : [];
- $requirements = isset($config['requirements']) ? $config['requirements'] : [];
- $options = isset($config['options']) ? $config['options'] : [];
- $host = isset($config['host']) ? $config['host'] : null;
- $condition = isset($config['condition']) ? $config['condition'] : null;
- $schemes = isset($config['schemes']) ? $config['schemes'] : null;
- $methods = isset($config['methods']) ? $config['methods'] : null;
+ $type = $config['type'] ?? null;
+ $prefix = $config['prefix'] ?? '';
+ $defaults = $config['defaults'] ?? [];
+ $requirements = $config['requirements'] ?? [];
+ $options = $config['options'] ?? [];
+ $host = $config['host'] ?? null;
+ $condition = $config['condition'] ?? null;
+ $schemes = $config['schemes'] ?? null;
+ $methods = $config['methods'] ?? null;
$trailingSlashOnRoot = $config['trailing_slash_on_root'] ?? true;
$exclude = $config['exclude'] ?? null;
diff --git a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
index 3c8c451680..b662fc0ec0 100644
--- a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
+++ b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
@@ -146,7 +146,7 @@ class TraceableUrlMatcher extends UrlMatcher
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
- return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
+ return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
}
return [];
diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
index 59452d8873..328b0e907a 100644
--- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
+++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
@@ -192,7 +192,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
continue;
}
- return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
+ return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
}
return [];
diff --git a/src/Symfony/Component/Routing/RequestContext.php b/src/Symfony/Component/Routing/RequestContext.php
index 1d68b17e39..b1982a63f5 100644
--- a/src/Symfony/Component/Routing/RequestContext.php
+++ b/src/Symfony/Component/Routing/RequestContext.php
@@ -294,7 +294,7 @@ class RequestContext
*/
public function getParameter($name)
{
- return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
+ return $this->parameters[$name] ?? null;
}
/**
diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php
index 7f20c794c9..fb7f98c0c9 100644
--- a/src/Symfony/Component/Routing/Route.php
+++ b/src/Symfony/Component/Routing/Route.php
@@ -324,7 +324,7 @@ class Route implements \Serializable
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
@@ -397,7 +397,7 @@ class Route implements \Serializable
*/
public function getDefault($name)
{
- return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
+ return $this->defaults[$name] ?? null;
}
/**
@@ -490,7 +490,7 @@ class Route implements \Serializable
*/
public function getRequirement($key)
{
- return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
+ return $this->requirements[$key] ?? null;
}
/**
diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php
index 6537bbae92..3baf0986c5 100644
--- a/src/Symfony/Component/Routing/RouteCollection.php
+++ b/src/Symfony/Component/Routing/RouteCollection.php
@@ -97,7 +97,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
*/
public function get($name)
{
- return isset($this->routes[$name]) ? $this->routes[$name] : null;
+ return $this->routes[$name] ?? null;
}
/**
diff --git a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
index b9f1f6e79e..0901d6b1ee 100644
--- a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
+++ b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
@@ -35,9 +35,9 @@ class InMemoryUserProvider implements UserProviderInterface
public function __construct(array $users = [])
{
foreach ($users as $username => $attributes) {
- $password = isset($attributes['password']) ? $attributes['password'] : null;
- $enabled = isset($attributes['enabled']) ? $attributes['enabled'] : true;
- $roles = isset($attributes['roles']) ? $attributes['roles'] : [];
+ $password = $attributes['password'] ?? null;
+ $enabled = $attributes['enabled'] ?? true;
+ $roles = $attributes['roles'] ?? [];
$user = new User($username, $password, $roles, $enabled, true, true, true);
$this->createUser($user);
diff --git a/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php b/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php
index 9367a62b33..4647cb3213 100644
--- a/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php
+++ b/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php
@@ -38,7 +38,7 @@ class CookieClearingLogoutHandler implements LogoutHandlerInterface
public function logout(Request $request, Response $response, TokenInterface $token)
{
foreach ($this->cookies as $cookieName => $cookieData) {
- $response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], isset($cookieData['secure']) ? $cookieData['secure'] : false, true, isset($cookieData['samesite']) ? $cookieData['samesite'] : null);
+ $response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], $cookieData['secure'] ?? false, true, $cookieData['samesite'] ?? null);
}
}
}
diff --git a/src/Symfony/Component/Templating/Helper/SlotsHelper.php b/src/Symfony/Component/Templating/Helper/SlotsHelper.php
index 80acdc93b6..4f705b4194 100644
--- a/src/Symfony/Component/Templating/Helper/SlotsHelper.php
+++ b/src/Symfony/Component/Templating/Helper/SlotsHelper.php
@@ -82,7 +82,7 @@ class SlotsHelper extends Helper
*/
public function get($name, $default = false)
{
- return isset($this->slots[$name]) ? $this->slots[$name] : $default;
+ return $this->slots[$name] ?? $default;
}
/**
diff --git a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
index 9b6da11027..e4f0b3a5ac 100644
--- a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
+++ b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
@@ -69,7 +69,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
*/
public function getMessages()
{
- return isset($this->data['messages']) ? $this->data['messages'] : [];
+ return $this->data['messages'] ?? [];
}
/**
@@ -77,7 +77,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
*/
public function getCountMissings()
{
- return isset($this->data[DataCollectorTranslator::MESSAGE_MISSING]) ? $this->data[DataCollectorTranslator::MESSAGE_MISSING] : 0;
+ return $this->data[DataCollectorTranslator::MESSAGE_MISSING] ?? 0;
}
/**
@@ -85,7 +85,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
*/
public function getCountFallbacks()
{
- return isset($this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK]) ? $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] : 0;
+ return $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] ?? 0;
}
/**
@@ -93,7 +93,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
*/
public function getCountDefines()
{
- return isset($this->data[DataCollectorTranslator::MESSAGE_DEFINED]) ? $this->data[DataCollectorTranslator::MESSAGE_DEFINED] : 0;
+ return $this->data[DataCollectorTranslator::MESSAGE_DEFINED] ?? 0;
}
public function getLocale()
diff --git a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
index dd9d788bad..72d9c6e9f3 100644
--- a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
+++ b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
@@ -162,7 +162,7 @@ class XliffFileDumper extends FileDumper
$notesElement = $dom->createElement('notes');
foreach ($metadata['notes'] as $note) {
$n = $dom->createElement('note');
- $n->appendChild($dom->createTextNode(isset($note['content']) ? $note['content'] : ''));
+ $n->appendChild($dom->createTextNode($note['content'] ?? ''));
unset($note['content']);
foreach ($note as $name => $value) {
diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
index e744d6d0f8..35fcc1ec4a 100644
--- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
@@ -139,7 +139,7 @@ class XliffFileLoader implements LoaderInterface
// If the xlf file has another encoding specified, try to convert it because
// simple_xml will always return utf-8 encoded values
- $target = $this->utf8ToCharset((string) (isset($segment->target) ? $segment->target : $source), $encoding);
+ $target = $this->utf8ToCharset((string) ($segment->target ?? $source), $encoding);
$catalogue->set((string) $source, $target, $domain);
diff --git a/src/Symfony/Component/Validator/Constraints/GroupSequence.php b/src/Symfony/Component/Validator/Constraints/GroupSequence.php
index be5bdc4bec..569d2a0648 100644
--- a/src/Symfony/Component/Validator/Constraints/GroupSequence.php
+++ b/src/Symfony/Component/Validator/Constraints/GroupSequence.php
@@ -84,6 +84,6 @@ class GroupSequence
public function __construct(array $groups)
{
// Support for Doctrine annotations
- $this->groups = isset($groups['value']) ? $groups['value'] : $groups;
+ $this->groups = $groups['value'] ?? $groups;
}
}
diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php
index e99ab7b565..3ea17526c8 100644
--- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php
+++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php
@@ -138,10 +138,10 @@ class ExceptionCaster
$frame = new FrameStub(
[
- 'object' => isset($f['object']) ? $f['object'] : null,
- 'class' => isset($f['class']) ? $f['class'] : null,
- 'type' => isset($f['type']) ? $f['type'] : null,
- 'function' => isset($f['function']) ? $f['function'] : null,
+ 'object' => $f['object'] ?? null,
+ 'class' => $f['class'] ?? null,
+ 'type' => $f['type'] ?? null,
+ 'function' => $f['function'] ?? null,
] + $frames[$i - 1],
false,
true
@@ -160,7 +160,7 @@ class ExceptionCaster
}
$f = $frames[$i - 1];
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
- $frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
+ $frame->value['arguments'] = new ArgsStub($f['args'], $f['function'] ?? null, $f['class'] ?? null);
}
} elseif ('???' !== $lastCall) {
$label = new ClassStub($lastCall);
@@ -209,12 +209,12 @@ class ExceptionCaster
$srcKey = $f['file'];
$ellipsis = new LinkStub($srcKey, 0);
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
- $ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
- $ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;
+ $ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0;
+ $ellipsis = $ellipsis->attr['ellipsis'] ?? 0;
if (file_exists($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
- $template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
+ $template = $f['object'] ?? unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
$ellipsis = 0;
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
@@ -312,7 +312,7 @@ class ExceptionCaster
$src = [];
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
- $src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
+ $src[] = ($srcLines[$i] ?? '')."\n";
}
if ($frame['function'] ?? false) {
diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
index 4634335fe6..144269cadd 100644
--- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
+++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
@@ -114,7 +114,7 @@ class ReflectionCaster
}
$function = $c->getFunction();
$frame = [
- 'class' => isset($function->class) ? $function->class : null,
+ 'class' => $function->class ?? null,
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
'function' => $function->name,
'file' => $c->getExecutingFile(),
diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php
index 013a69dd98..c9487f9208 100644
--- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php
+++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php
@@ -409,7 +409,7 @@ class CliDumper extends AbstractDumper
}
}
- $this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
+ $this->line .= $bin.$this->style($style, $key[1], $attr).($attr['separator'] ?? ': ');
} else {
// This case should not happen
$this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": ';
@@ -467,7 +467,7 @@ class CliDumper extends AbstractDumper
$s = $startCchr;
$c = $c[$i = 0];
do {
- $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
+ $s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.$endCchr;
@@ -488,7 +488,7 @@ class CliDumper extends AbstractDumper
href:
if ($this->colors && $this->handlesHrefGracefully) {
- if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
+ if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
if ('note' === $style) {
$value .= "\033]8;;{$href}\033\\^\033]8;;\033\\";
} else {
diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
index 8320f5adf8..6b205a7373 100644
--- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
+++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
@@ -936,13 +936,13 @@ EOHTML
$s .= '">';
}
- $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
+ $s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.'';
}, $v).'';
- if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
+ if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
$attr['href'] = $href;
}
if (isset($attr['href'])) {
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index 7768e0066c..8ca26e0e8f 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -724,7 +724,7 @@ class Parser
}
if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
- $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
+ $modifiers = $matches['modifiers'] ?? '';
$data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers));