CS: Apply ternary_to_null_coalescing fixer
This commit is contained in:
parent
0ed047f49d
commit
07c4773d98
@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
|
|||||||
'combine_nested_dirname' => true,
|
'combine_nested_dirname' => true,
|
||||||
'list_syntax' => ['syntax' => 'short'],
|
'list_syntax' => ['syntax' => 'short'],
|
||||||
'visibility_required' => ['property', 'method', 'const'],
|
'visibility_required' => ['property', 'method', 'const'],
|
||||||
|
'ternary_to_null_coalescing' => true,
|
||||||
])
|
])
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setFinder(
|
->setFinder(
|
||||||
|
@ -134,7 +134,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
|||||||
|
|
||||||
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $tags) {
|
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $tags) {
|
||||||
foreach ($tags as $attributes) {
|
foreach ($tags as $attributes) {
|
||||||
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
|
$priority = $attributes['priority'] ?? 0;
|
||||||
$sortedTags[$priority][] = [$serviceId, $attributes];
|
$sortedTags[$priority][] = [$serviceId, $attributes];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
|
$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)
|
$this->context->buildViolation($constraint->message)
|
||||||
->atPath($errorPath)
|
->atPath($errorPath)
|
||||||
|
@ -38,7 +38,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
|
|||||||
'priority' => $record['level'],
|
'priority' => $record['level'],
|
||||||
'priorityName' => $record['level_name'],
|
'priorityName' => $record['level_name'],
|
||||||
'context' => $record['context'],
|
'context' => $record['context'],
|
||||||
'channel' => isset($record['channel']) ? $record['channel'] : '',
|
'channel' => $record['channel'] ?? '',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!isset($this->errorCount[$hash])) {
|
if (!isset($this->errorCount[$hash])) {
|
||||||
|
@ -42,7 +42,7 @@ class HttpKernelRuntime
|
|||||||
*/
|
*/
|
||||||
public function renderFragment($uri, $options = [])
|
public function renderFragment($uri, $options = [])
|
||||||
{
|
{
|
||||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
|
$strategy = $options['strategy'] ?? 'inline';
|
||||||
unset($options['strategy']);
|
unset($options['strategy']);
|
||||||
|
|
||||||
return $this->handler->render($uri, $strategy, $options);
|
return $this->handler->render($uri, $strategy, $options);
|
||||||
|
@ -45,7 +45,7 @@ class SearchAndRenderBlockNode extends FunctionExpression
|
|||||||
// The "label" function expects the label in the second and
|
// The "label" function expects the label in the second and
|
||||||
// the variables in the third argument
|
// the variables in the third argument
|
||||||
$label = $arguments[1];
|
$label = $arguments[1];
|
||||||
$variables = isset($arguments[2]) ? $arguments[2] : null;
|
$variables = $arguments[2] ?? null;
|
||||||
$lineno = $label->getTemplateLine();
|
$lineno = $label->getTemplateLine();
|
||||||
|
|
||||||
if ($label instanceof ConstantExpression) {
|
if ($label instanceof ConstantExpression) {
|
||||||
|
@ -144,7 +144,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
|
|
||||||
protected function describeContainerParameter($parameter, array $options = [])
|
protected function describeContainerParameter($parameter, array $options = [])
|
||||||
{
|
{
|
||||||
$key = isset($options['parameter']) ? $options['parameter'] : '';
|
$key = $options['parameter'] ?? '';
|
||||||
|
|
||||||
$this->writeData([$key => $parameter], $options);
|
$this->writeData([$key => $parameter], $options);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
|
|
||||||
private function writeData(array $data, array $options)
|
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");
|
$this->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class TextDescriptor extends Descriptor
|
|||||||
{
|
{
|
||||||
$tableHeaders = ['Property', 'Value'];
|
$tableHeaders = ['Property', 'Value'];
|
||||||
$tableRows = [
|
$tableRows = [
|
||||||
['Route Name', isset($options['name']) ? $options['name'] : ''],
|
['Route Name', $options['name'] ?? ''],
|
||||||
['Path', $route->getPath()],
|
['Path', $route->getPath()],
|
||||||
['Path Regex', $route->compile()->getRegex()],
|
['Path Regex', $route->compile()->getRegex()],
|
||||||
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
|
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
|
||||||
@ -150,7 +150,7 @@ class TextDescriptor extends Descriptor
|
|||||||
$options['output']->table(
|
$options['output']->table(
|
||||||
['Service ID', 'Class'],
|
['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 = [])
|
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
|
||||||
{
|
{
|
||||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||||
$showTag = isset($options['tag']) ? $options['tag'] : null;
|
$showTag = $options['tag'] ?? null;
|
||||||
|
|
||||||
if ($showHidden) {
|
if ($showHidden) {
|
||||||
$title = 'Symfony Container Hidden Services';
|
$title = 'Symfony Container Hidden Services';
|
||||||
@ -223,7 +223,7 @@ class TextDescriptor extends Descriptor
|
|||||||
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
|
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
|
||||||
$tagValues = [];
|
$tagValues = [];
|
||||||
foreach ($tagsNames as $tagName) {
|
foreach ($tagsNames as $tagName) {
|
||||||
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
|
$tagValues[] = $tag[$tagName] ?? '';
|
||||||
}
|
}
|
||||||
if (0 === $key) {
|
if (0 === $key) {
|
||||||
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
|
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
|
||||||
@ -257,7 +257,7 @@ class TextDescriptor extends Descriptor
|
|||||||
|
|
||||||
$tableHeaders = ['Option', 'Value'];
|
$tableHeaders = ['Option', 'Value'];
|
||||||
|
|
||||||
$tableRows[] = ['Service ID', isset($options['id']) ? $options['id'] : '-'];
|
$tableRows[] = ['Service ID', $options['id'] ?? '-'];
|
||||||
$tableRows[] = ['Class', $definition->getClass() ?: '-'];
|
$tableRows[] = ['Class', $definition->getClass() ?: '-'];
|
||||||
|
|
||||||
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];
|
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];
|
||||||
|
@ -38,7 +38,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
|
|
||||||
protected function describeRoute(Route $route, array $options = [])
|
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 = [])
|
protected function describeContainerParameters(ParameterBag $parameters, array $options = [])
|
||||||
@ -62,18 +62,18 @@ class XmlDescriptor extends Descriptor
|
|||||||
|
|
||||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = [])
|
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 = [])
|
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)
|
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
|
||||||
{
|
{
|
||||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
$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) {
|
if (!$builder) {
|
||||||
$this->writeDocument($dom);
|
$this->writeDocument($dom);
|
||||||
|
@ -34,7 +34,7 @@ class ProfilerPass implements CompilerPassInterface
|
|||||||
$collectors = new \SplPriorityQueue();
|
$collectors = new \SplPriorityQueue();
|
||||||
$order = \PHP_INT_MAX;
|
$order = \PHP_INT_MAX;
|
||||||
foreach ($container->findTaggedServiceIds('data_collector', true) as $id => $attributes) {
|
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;
|
$template = null;
|
||||||
|
|
||||||
if (isset($attributes[0]['template'])) {
|
if (isset($attributes[0]['template'])) {
|
||||||
|
@ -230,7 +230,7 @@ class FrameworkExtension extends Extension
|
|||||||
// mark any env vars found in the ide setting as used
|
// mark any env vars found in the ide setting as used
|
||||||
$container->resolveEnvPlaceholders($ide);
|
$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%');
|
$container->setParameter('debug.file_link_format', '%templating.helper.code.file_link_format%');
|
||||||
}
|
}
|
||||||
@ -1083,7 +1083,7 @@ class FrameworkExtension extends Extension
|
|||||||
} else {
|
} else {
|
||||||
// let format fallback to main version_format
|
// let format fallback to main version_format
|
||||||
$format = $package['version_format'] ?: $config['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);
|
$version = $this->createVersion($container, $version, $format, $package['json_manifest_path'], $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'color']);
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'color']);
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'email']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'email']) ?>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if (false !== $label): ?>
|
<?php if (false !== $label): ?>
|
||||||
<?php if ($required) { $label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '').' required'); } ?>
|
<?php if ($required) { $label_attr['class'] = trim(($label_attr['class'] ?? '').' required'); } ?>
|
||||||
<?php if (!$compound) { $label_attr['for'] = $id; } ?>
|
<?php if (!$compound) { $label_attr['for'] = $id; } ?>
|
||||||
<?php if (!$label) { $label = isset($label_format)
|
<?php if (!$label) { $label = isset($label_format)
|
||||||
? strtr($label_format, ['%name%' => $name, '%id%' => $id])
|
? strtr($label_format, ['%name%' => $name, '%id%' => $id])
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'hidden']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'hidden']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'number']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'number']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'text']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'text']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'password']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'password']) ?>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<?php $symbol = false !== $symbol ? ($symbol ? ' '.$symbol : ' %') : '' ?>
|
<?php $symbol = false !== $symbol ? ($symbol ? ' '.$symbol : ' %') : '' ?>
|
||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'text']).$view->escape($symbol) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'text']).$view->escape($symbol) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'range']);
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'range']);
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'button_widget', ['type' => isset($type) ? $type : 'reset']) ?>
|
<?php echo $view['form']->block($form, 'button_widget', ['type' => $type ?? 'reset']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'search']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'search']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'button_widget', ['type' => isset($type) ? $type : 'submit']) ?>
|
<?php echo $view['form']->block($form, 'button_widget', ['type' => $type ?? 'submit']) ?>
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'tel']);
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'tel']);
|
||||||
|
@ -1 +1 @@
|
|||||||
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => isset($type) ? $type : 'url']) ?>
|
<?php echo $view['form']->block($form, 'form_widget_simple', ['type' => $type ?? 'url']) ?>
|
||||||
|
@ -44,7 +44,7 @@ class ActionsHelper extends Helper
|
|||||||
*/
|
*/
|
||||||
public function render($uri, array $options = [])
|
public function render($uri, array $options = [])
|
||||||
{
|
{
|
||||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
|
$strategy = $options['strategy'] ?? 'inline';
|
||||||
unset($options['strategy']);
|
unset($options['strategy']);
|
||||||
|
|
||||||
return $this->handler->render($uri, $strategy, $options);
|
return $this->handler->render($uri, $strategy, $options);
|
||||||
|
@ -61,9 +61,9 @@ abstract class AbstractWebTestCase extends BaseWebTestCase
|
|||||||
return new $class(
|
return new $class(
|
||||||
static::getVarDir(),
|
static::getVarDir(),
|
||||||
$options['test_case'],
|
$options['test_case'],
|
||||||
isset($options['root_config']) ? $options['root_config'] : 'config.yml',
|
$options['root_config'] ?? 'config.yml',
|
||||||
isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
|
$options['environment'] ?? strtolower(static::getVarDir().$options['test_case']),
|
||||||
isset($options['debug']) ? $options['debug'] : false
|
$options['debug'] ?? false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ class RouterTest extends TestCase
|
|||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('get')
|
->method('get')
|
||||||
->willReturnCallback(function ($key) use ($params) {
|
->willReturnCallback(function ($key) use ($params) {
|
||||||
return isset($params[$key]) ? $params[$key] : null;
|
return $params[$key] ?? null;
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<?php $type = isset($type) ? $type : 'text'; ?>
|
<?php $type = $type ?? 'text'; ?>
|
||||||
<input type="<?php echo $type; ?>" <?php $view['form']->block($form, 'widget_attributes'); ?> value="<?php echo $value; ?>" rel="theme" />
|
<input type="<?php echo $type; ?>" <?php $view['form']->block($form, 'widget_attributes'); ?> value="<?php echo $value; ?>" rel="theme" />
|
||||||
|
@ -283,9 +283,9 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
|||||||
if (isset($firewall['request_matcher'])) {
|
if (isset($firewall['request_matcher'])) {
|
||||||
$matcher = new Reference($firewall['request_matcher']);
|
$matcher = new Reference($firewall['request_matcher']);
|
||||||
} elseif (isset($firewall['pattern']) || isset($firewall['host'])) {
|
} elseif (isset($firewall['pattern']) || isset($firewall['host'])) {
|
||||||
$pattern = isset($firewall['pattern']) ? $firewall['pattern'] : null;
|
$pattern = $firewall['pattern'] ?? null;
|
||||||
$host = isset($firewall['host']) ? $firewall['host'] : null;
|
$host = $firewall['host'] ?? null;
|
||||||
$methods = isset($firewall['methods']) ? $firewall['methods'] : [];
|
$methods = $firewall['methods'] ?? [];
|
||||||
$matcher = $this->createRequestMatcher($container, $pattern, $host, null, $methods);
|
$matcher = $this->createRequestMatcher($container, $pattern, $host, null, $methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine default entry point
|
// Determine default entry point
|
||||||
$configuredEntryPoint = isset($firewall['entry_point']) ? $firewall['entry_point'] : null;
|
$configuredEntryPoint = $firewall['entry_point'] ?? null;
|
||||||
|
|
||||||
// Authentication listeners
|
// Authentication listeners
|
||||||
[$authListeners, $defaultEntryPoint] = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $providerIds, $configuredEntryPoint, $contextListenerId);
|
[$authListeners, $defaultEntryPoint] = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $providerIds, $configuredEntryPoint, $contextListenerId);
|
||||||
@ -415,8 +415,8 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
|||||||
// Exception listener
|
// Exception listener
|
||||||
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless']));
|
$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(8, $firewall['access_denied_handler'] ?? null);
|
||||||
$config->replaceArgument(9, isset($firewall['access_denied_url']) ? $firewall['access_denied_url'] : null);
|
$config->replaceArgument(9, $firewall['access_denied_url'] ?? null);
|
||||||
|
|
||||||
$container->setAlias('security.user_checker.'.$id, new Alias($firewall['user_checker'], false));
|
$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(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];
|
return [$matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null];
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,9 @@ abstract class AbstractWebTestCase extends BaseWebTestCase
|
|||||||
return new $class(
|
return new $class(
|
||||||
static::getVarDir(),
|
static::getVarDir(),
|
||||||
$options['test_case'],
|
$options['test_case'],
|
||||||
isset($options['root_config']) ? $options['root_config'] : 'config.yml',
|
$options['root_config'] ?? 'config.yml',
|
||||||
isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
|
$options['environment'] ?? strtolower(static::getVarDir().$options['test_case']),
|
||||||
isset($options['debug']) ? $options['debug'] : false
|
$options['debug'] ?? false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class ExceptionController
|
|||||||
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
|
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $showException),
|
||||||
[
|
[
|
||||||
'status_code' => $code,
|
'status_code' => $code,
|
||||||
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
|
'status_text' => Response::$statusTexts[$code] ?? '',
|
||||||
'exception' => $exception,
|
'exception' => $exception,
|
||||||
'logger' => $logger,
|
'logger' => $logger,
|
||||||
'currentContent' => $currentContent,
|
'currentContent' => $currentContent,
|
||||||
|
@ -33,7 +33,7 @@ class TwigLoaderPass implements CompilerPassInterface
|
|||||||
$found = 0;
|
$found = 0;
|
||||||
|
|
||||||
foreach ($container->findTaggedServiceIds('twig.loader', true) as $id => $attributes) {
|
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;
|
$prioritizedLoaders[$priority][] = $id;
|
||||||
++$found;
|
++$found;
|
||||||
}
|
}
|
||||||
|
@ -403,8 +403,8 @@ class ProfilerController
|
|||||||
|
|
||||||
$nonces = $this->cspHandler ? $this->cspHandler->getNonces($request, $response) : [];
|
$nonces = $this->cspHandler ? $this->cspHandler->getNonces($request, $response) : [];
|
||||||
|
|
||||||
$variables['csp_script_nonce'] = isset($nonces['csp_script_nonce']) ? $nonces['csp_script_nonce'] : null;
|
$variables['csp_script_nonce'] = $nonces['csp_script_nonce'] ?? null;
|
||||||
$variables['csp_style_nonce'] = isset($nonces['csp_style_nonce']) ? $nonces['csp_style_nonce'] : null;
|
$variables['csp_style_nonce'] = $nonces['csp_style_nonce'] ?? null;
|
||||||
|
|
||||||
$response->setContent($this->twig->render($template, $variables));
|
$response->setContent($this->twig->render($template, $variables));
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
|||||||
'excluded_ajax_paths' => $this->excludedAjaxPaths,
|
'excluded_ajax_paths' => $this->excludedAjaxPaths,
|
||||||
'token' => $response->headers->get('X-Debug-Token'),
|
'token' => $response->headers->get('X-Debug-Token'),
|
||||||
'request' => $request,
|
'request' => $request,
|
||||||
'csp_script_nonce' => isset($nonces['csp_script_nonce']) ? $nonces['csp_script_nonce'] : null,
|
'csp_script_nonce' => $nonces['csp_script_nonce'] ?? null,
|
||||||
'csp_style_nonce' => isset($nonces['csp_style_nonce']) ? $nonces['csp_style_nonce'] : null,
|
'csp_style_nonce' => $nonces['csp_style_nonce'] ?? null,
|
||||||
]
|
]
|
||||||
))."\n";
|
))."\n";
|
||||||
$content = substr($content, 0, $pos).$toolbar.substr($content, $pos);
|
$content = substr($content, 0, $pos).$toolbar.substr($content, $pos);
|
||||||
|
@ -30,7 +30,7 @@ if (is_file($_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME
|
|||||||
return false;
|
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 = array_merge($_SERVER, $_ENV);
|
||||||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$script;
|
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$script;
|
||||||
|
@ -63,6 +63,6 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset($this->manifestData[$path]) ? $this->manifestData[$path] : null;
|
return $this->manifestData[$path] ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ abstract class Client
|
|||||||
*/
|
*/
|
||||||
public function getServerParameter($key, $default = '')
|
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
|
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 {
|
} else {
|
||||||
$currentUri = sprintf('http%s://%s/',
|
$currentUri = sprintf('http%s://%s/',
|
||||||
isset($this->server['HTTPS']) ? 's' : '',
|
isset($this->server['HTTPS']) ? 's' : '',
|
||||||
isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost'
|
$this->server['HTTP_HOST'] ?? 'localhost'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
$missing = [];
|
$missing = [];
|
||||||
$misses = [];
|
$misses = [];
|
||||||
$nextAdapterIndex = $adapterIndex + 1;
|
$nextAdapterIndex = $adapterIndex + 1;
|
||||||
$nextAdapter = isset($this->adapters[$nextAdapterIndex]) ? $this->adapters[$nextAdapterIndex] : null;
|
$nextAdapter = $this->adapters[$nextAdapterIndex] ?? null;
|
||||||
|
|
||||||
foreach ($items as $k => $item) {
|
foreach ($items as $k => $item) {
|
||||||
if (!$nextAdapter || $item->isHit()) {
|
if (!$nextAdapter || $item->isHit()) {
|
||||||
|
@ -280,7 +280,7 @@ EOLUA;
|
|||||||
|
|
||||||
foreach ($this->getHosts() as $host) {
|
foreach ($this->getHosts() as $host) {
|
||||||
$info = $host->info('Memory');
|
$info = $host->info('Memory');
|
||||||
$info = isset($info['Memory']) ? $info['Memory'] : $info;
|
$info = $info['Memory'] ?? $info;
|
||||||
|
|
||||||
return $this->redisEvictionPolicy = $info['maxmemory_policy'];
|
return $this->redisEvictionPolicy = $info['maxmemory_policy'];
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class ChainCache implements Psr16CacheInterface, PruneableInterface, ResettableI
|
|||||||
{
|
{
|
||||||
$missing = [];
|
$missing = [];
|
||||||
$nextCacheIndex = $cacheIndex + 1;
|
$nextCacheIndex = $cacheIndex + 1;
|
||||||
$nextCache = isset($this->caches[$nextCacheIndex]) ? $this->caches[$nextCacheIndex] : null;
|
$nextCache = $this->caches[$nextCacheIndex] ?? null;
|
||||||
|
|
||||||
foreach ($values as $k => $value) {
|
foreach ($values as $k => $value) {
|
||||||
if ($miss !== $value) {
|
if ($miss !== $value) {
|
||||||
|
@ -151,7 +151,7 @@ trait MemcachedTrait
|
|||||||
$params['path'] = substr($params['path'], 0, -\strlen($m[0]));
|
$params['path'] = substr($params['path'], 0, -\strlen($m[0]));
|
||||||
}
|
}
|
||||||
$params += [
|
$params += [
|
||||||
'host' => isset($params['host']) ? $params['host'] : $params['path'],
|
'host' => $params['host'] ?? $params['path'],
|
||||||
'port' => isset($params['host']) ? 11211 : null,
|
'port' => isset($params['host']) ? 11211 : null,
|
||||||
'weight' => 0,
|
'weight' => 0,
|
||||||
];
|
];
|
||||||
|
@ -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)));
|
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->table = $options['db_table'] ?? $this->table;
|
||||||
$this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
|
$this->idCol = $options['db_id_col'] ?? $this->idCol;
|
||||||
$this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
|
$this->dataCol = $options['db_data_col'] ?? $this->dataCol;
|
||||||
$this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
|
$this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol;
|
||||||
$this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
|
$this->timeCol = $options['db_time_col'] ?? $this->timeCol;
|
||||||
$this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
|
$this->username = $options['db_username'] ?? $this->username;
|
||||||
$this->password = isset($options['db_password']) ? $options['db_password'] : $this->password;
|
$this->password = $options['db_password'] ?? $this->password;
|
||||||
$this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions;
|
$this->connectionOptions = $options['db_connection_options'] ?? $this->connectionOptions;
|
||||||
$this->namespace = $namespace;
|
$this->namespace = $namespace;
|
||||||
$this->marshaller = $marshaller ?? new DefaultMarshaller();
|
$this->marshaller = $marshaller ?? new DefaultMarshaller();
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ trait RedisTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
$info = $host->info('Server');
|
$info = $host->info('Server');
|
||||||
$info = isset($info['Server']) ? $info['Server'] : $info;
|
$info = $info['Server'] ?? $info;
|
||||||
|
|
||||||
if (!version_compare($info['redis_version'], '2.8', '>=')) {
|
if (!version_compare($info['redis_version'], '2.8', '>=')) {
|
||||||
// As documented in Redis documentation (http://redis.io/commands/keys) using KEYS
|
// As documented in Redis documentation (http://redis.io/commands/keys) using KEYS
|
||||||
|
@ -112,7 +112,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
*/
|
*/
|
||||||
public function getAttribute($key, $default = null)
|
public function getAttribute($key, $default = null)
|
||||||
{
|
{
|
||||||
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
|
return $this->attributes[$key] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,7 +281,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
->ifArray()
|
->ifArray()
|
||||||
->then(function ($v) {
|
->then(function ($v) {
|
||||||
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
|
$v['enabled'] = $v['enabled'] ?? true;
|
||||||
|
|
||||||
return $v;
|
return $v;
|
||||||
})
|
})
|
||||||
|
@ -367,7 +367,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
*/
|
*/
|
||||||
private function getPrototypeForChild(string $key)
|
private function getPrototypeForChild(string $key)
|
||||||
{
|
{
|
||||||
$prototype = isset($this->valuePrototypes[$key]) ? $this->valuePrototypes[$key] : $this->prototype;
|
$prototype = $this->valuePrototypes[$key] ?? $this->prototype;
|
||||||
$prototype->setName($key);
|
$prototype->setName($key);
|
||||||
|
|
||||||
return $prototype;
|
return $prototype;
|
||||||
|
@ -97,7 +97,7 @@ abstract class FileLoader extends Loader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($isSubpath) {
|
if ($isSubpath) {
|
||||||
return isset($ret[1]) ? $ret : (isset($ret[0]) ? $ret[0] : null);
|
return isset($ret[1]) ? $ret : ($ret[0] ?? null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,8 +219,8 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$props = [
|
$props = [
|
||||||
'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
|
'file' => $callerFrame['file'] ?? null,
|
||||||
'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
|
'line' => $callerFrame['line'] ?? null,
|
||||||
'trace' => \array_slice($trace, 1 + $i),
|
'trace' => \array_slice($trace, 1 + $i),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -925,11 +925,11 @@ class Application implements ResetInterface
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
|
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
|
||||||
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
|
$class = $trace[$i]['class'] ?? '';
|
||||||
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
|
$type = $trace[$i]['type'] ?? '';
|
||||||
$function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
|
$function = $trace[$i]['function'] ?? '';
|
||||||
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
$file = $trace[$i]['file'] ?? 'n/a';
|
||||||
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
$line = $trace[$i]['line'] ?? 'n/a';
|
||||||
|
|
||||||
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
|
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class ApplicationDescription
|
|||||||
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
|
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()
|
private function inspectApplication()
|
||||||
|
@ -63,7 +63,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeApplication(Application $application, array $options = [])
|
protected function describeApplication(Application $application, array $options = [])
|
||||||
{
|
{
|
||||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
$describedNamespace = $options['namespace'] ?? null;
|
||||||
$description = new ApplicationDescription($application, $describedNamespace, true);
|
$description = new ApplicationDescription($application, $describedNamespace, true);
|
||||||
$commands = [];
|
$commands = [];
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
private function writeData(array $data, array $options)
|
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));
|
$this->write(json_encode($data, $flags));
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeApplication(Application $application, array $options = [])
|
protected function describeApplication(Application $application, array $options = [])
|
||||||
{
|
{
|
||||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
$describedNamespace = $options['namespace'] ?? null;
|
||||||
$description = new ApplicationDescription($application, $describedNamespace);
|
$description = new ApplicationDescription($application, $describedNamespace);
|
||||||
$title = $this->getApplicationTitle($application);
|
$title = $this->getApplicationTitle($application);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class TextDescriptor extends Descriptor
|
|||||||
$default = '';
|
$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());
|
$spacingWidth = $totalWidth - \strlen($argument->getName());
|
||||||
|
|
||||||
$this->writeText(sprintf(' <info>%s</info> %s%s%s',
|
$this->writeText(sprintf(' <info>%s</info> %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',
|
$synopsis = sprintf('%s%s',
|
||||||
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
|
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
|
||||||
sprintf('--%s%s', $option->getName(), $value)
|
sprintf('--%s%s', $option->getName(), $value)
|
||||||
@ -176,7 +176,7 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeApplication(Application $application, array $options = [])
|
protected function describeApplication(Application $application, array $options = [])
|
||||||
{
|
{
|
||||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
$describedNamespace = $options['namespace'] ?? null;
|
||||||
$description = new ApplicationDescription($application, $describedNamespace);
|
$description = new ApplicationDescription($application, $describedNamespace);
|
||||||
|
|
||||||
if (isset($options['raw_text']) && $options['raw_text']) {
|
if (isset($options['raw_text']) && $options['raw_text']) {
|
||||||
|
@ -152,7 +152,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeApplication(Application $application, array $options = [])
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +163,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
|||||||
if ($open = '/' != $text[1]) {
|
if ($open = '/' != $text[1]) {
|
||||||
$tag = $matches[1][$i][0];
|
$tag = $matches[1][$i][0];
|
||||||
} else {
|
} else {
|
||||||
$tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
|
$tag = $matches[3][$i][0] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$open && !$tag) {
|
if (!$open && !$tag) {
|
||||||
|
@ -110,7 +110,7 @@ final class ProgressBar
|
|||||||
self::$formatters = self::initPlaceholderFormatters();
|
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();
|
self::$formats = self::initFormats();
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
return self::$formats[$name] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,7 +149,7 @@ class ProgressIndicator
|
|||||||
self::$formats = self::initFormats();
|
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();
|
self::$formatters = self::initPlaceholderFormatters();
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
|
return self::$formatters[$name] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function display()
|
private function display()
|
||||||
|
@ -170,13 +170,13 @@ class QuestionHelper extends Helper
|
|||||||
$choices = $question->getChoices();
|
$choices = $question->getChoices();
|
||||||
|
|
||||||
if (!$question->isMultiselect()) {
|
if (!$question->isMultiselect()) {
|
||||||
return isset($choices[$default]) ? $choices[$default] : $default;
|
return $choices[$default] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
$default = explode(',', $default);
|
$default = explode(',', $default);
|
||||||
foreach ($default as $k => $v) {
|
foreach ($default as $k => $v) {
|
||||||
$v = $question->isTrimmable() ? trim($v) : $v;
|
$v = $question->isTrimmable() ? trim($v) : $v;
|
||||||
$default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
|
$default[$k] = $choices[$v] ?? $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class SymfonyQuestionHelper extends QuestionHelper
|
|||||||
|
|
||||||
case $question instanceof ChoiceQuestion:
|
case $question instanceof ChoiceQuestion:
|
||||||
$choices = $question->getChoices();
|
$choices = $question->getChoices();
|
||||||
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
|
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ class Table
|
|||||||
*/
|
*/
|
||||||
private function renderCell(array $row, int $column, string $cellFormat): string
|
private function renderCell(array $row, int $column, string $cellFormat): string
|
||||||
{
|
{
|
||||||
$cell = isset($row[$column]) ? $row[$column] : '';
|
$cell = $row[$column] ?? '';
|
||||||
$width = $this->effectiveColumnWidths[$column];
|
$width = $this->effectiveColumnWidths[$column];
|
||||||
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
||||||
// add the width of the following columns(numbers of colspan).
|
// add the width of the following columns(numbers of colspan).
|
||||||
@ -637,7 +637,7 @@ class Table
|
|||||||
// create a two dimensional array (rowspan x colspan)
|
// create a two dimensional array (rowspan x colspan)
|
||||||
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
|
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
|
||||||
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
|
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()]);
|
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]);
|
||||||
if ($nbLines === $unmergedRowKey - $line) {
|
if ($nbLines === $unmergedRowKey - $line) {
|
||||||
break;
|
break;
|
||||||
@ -775,7 +775,7 @@ class Table
|
|||||||
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
$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);
|
$cellWidth = max($cellWidth, $columnWidth);
|
||||||
|
|
||||||
return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
|
return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
|
||||||
|
@ -110,7 +110,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,7 +295,7 @@ class SymfonyStyle extends OutputStyle
|
|||||||
{
|
{
|
||||||
if (null !== $default) {
|
if (null !== $default) {
|
||||||
$values = array_flip($choices);
|
$values = array_flip($choices);
|
||||||
$default = isset($values[$default]) ? $values[$default] : $default;
|
$default = $values[$default] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
|
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
|
||||||
|
@ -141,8 +141,8 @@ trait TesterTrait
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->output = new ConsoleOutput(
|
$this->output = new ConsoleOutput(
|
||||||
isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL,
|
$options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
|
||||||
isset($options['decorated']) ? $options['decorated'] : null
|
$options['decorated'] ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
|
$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
|
||||||
|
@ -84,7 +84,7 @@ class Parser implements ParserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$split = explode('n', $joined);
|
$split = explode('n', $joined);
|
||||||
$first = isset($split[0]) ? $split[0] : null;
|
$first = $split[0] ?? null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
|
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
|
||||||
|
@ -636,7 +636,7 @@ class ErrorHandler
|
|||||||
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
|
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
|
||||||
// Let's not throw anymore but keep logging
|
// Let's not throw anymore but keep logging
|
||||||
$handler->throwAt(0, true);
|
$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')) {
|
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);
|
$exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
|
||||||
|
@ -281,11 +281,11 @@ class FlattenException
|
|||||||
$this->trace[] = [
|
$this->trace[] = [
|
||||||
'namespace' => $namespace,
|
'namespace' => $namespace,
|
||||||
'short_class' => $class,
|
'short_class' => $class,
|
||||||
'class' => isset($entry['class']) ? $entry['class'] : '',
|
'class' => $entry['class'] ?? '',
|
||||||
'type' => isset($entry['type']) ? $entry['type'] : '',
|
'type' => $entry['type'] ?? '',
|
||||||
'function' => isset($entry['function']) ? $entry['function'] : null,
|
'function' => $entry['function'] ?? null,
|
||||||
'file' => isset($entry['file']) ? $entry['file'] : null,
|
'file' => $entry['file'] ?? null,
|
||||||
'line' => isset($entry['line']) ? $entry['line'] : null,
|
'line' => $entry['line'] ?? null,
|
||||||
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ class Definition
|
|||||||
*/
|
*/
|
||||||
public function getTag($name)
|
public function getTag($name)
|
||||||
{
|
{
|
||||||
return isset($this->tags[$name]) ? $this->tags[$name] : [];
|
return $this->tags[$name] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -508,7 +508,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = isset($service['tags']) ? $service['tags'] : [];
|
$tags = $service['tags'] ?? [];
|
||||||
if (!\is_array($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));
|
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));
|
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;
|
$renameId = $service['decoration_inner_name'] ?? null;
|
||||||
$priority = isset($service['decoration_priority']) ? $service['decoration_priority'] : 0;
|
$priority = $service['decoration_priority'] ?? 0;
|
||||||
|
|
||||||
$definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior);
|
$definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior);
|
||||||
}
|
}
|
||||||
@ -606,8 +606,8 @@ class YamlFileLoader extends FileLoader
|
|||||||
if (!\is_string($service['resource'])) {
|
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));
|
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;
|
$exclude = $service['exclude'] ?? null;
|
||||||
$namespace = isset($service['namespace']) ? $service['namespace'] : $id;
|
$namespace = $service['namespace'] ?? $id;
|
||||||
$this->registerClasses($definition, $namespace, $service['resource'], $exclude);
|
$this->registerClasses($definition, $namespace, $service['resource'], $exclude);
|
||||||
} else {
|
} else {
|
||||||
$this->setDefinition($id, $definition);
|
$this->setDefinition($id, $definition);
|
||||||
@ -789,7 +789,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
$instanceof = $this->instanceof;
|
$instanceof = $this->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, []);
|
$this->parseDefinition($id, $argument, $file, []);
|
||||||
|
|
||||||
if (!$this->container->hasDefinition($id)) {
|
if (!$this->container->hasDefinition($id)) {
|
||||||
|
@ -17,10 +17,10 @@ class ProjectExtension implements ExtensionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$configuration->register('project.service.bar', 'FooClass')->setPublic(true);
|
$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->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;
|
return $configuration;
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1134,7 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function getNode($position)
|
public function getNode($position)
|
||||||
{
|
{
|
||||||
return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
|
return $this->nodes[$position] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,7 +257,7 @@ final class Dotenv
|
|||||||
throw $this->createFormatException('Whitespace are not supported before the value');
|
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['']);
|
unset($loadedVars['']);
|
||||||
$v = '';
|
$v = '';
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ class ErrorHandler
|
|||||||
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
|
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
|
||||||
// Let's not throw anymore but keep logging
|
// Let's not throw anymore but keep logging
|
||||||
$handler->throwAt(0, true);
|
$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')) {
|
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);
|
$fatalError = new OutOfMemoryError($handler->levels[$error['type']].': '.$error['message'], 0, $error, 2, false, $trace);
|
||||||
|
@ -309,11 +309,11 @@ class FlattenException extends LegacyFlattenException
|
|||||||
$this->trace[] = [
|
$this->trace[] = [
|
||||||
'namespace' => $namespace,
|
'namespace' => $namespace,
|
||||||
'short_class' => $class,
|
'short_class' => $class,
|
||||||
'class' => isset($entry['class']) ? $entry['class'] : '',
|
'class' => $entry['class'] ?? '',
|
||||||
'type' => isset($entry['type']) ? $entry['type'] : '',
|
'type' => $entry['type'] ?? '',
|
||||||
'function' => isset($entry['function']) ? $entry['function'] : null,
|
'function' => $entry['function'] ?? null,
|
||||||
'file' => isset($entry['file']) ? $entry['file'] : null,
|
'file' => $entry['file'] ?? null,
|
||||||
'line' => isset($entry['line']) ? $entry['line'] : null,
|
'line' => $entry['line'] ?? null,
|
||||||
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class RegisterListenersPass implements CompilerPassInterface
|
|||||||
|
|
||||||
foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) {
|
foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) {
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$priority = isset($event['priority']) ? $event['priority'] : 0;
|
$priority = $event['priority'] ?? 0;
|
||||||
|
|
||||||
if (!isset($event['event'])) {
|
if (!isset($event['event'])) {
|
||||||
if ($container->getDefinition($id)->hasTag($this->subscriberTag)) {
|
if ($container->getDefinition($id)->hasTag($this->subscriberTag)) {
|
||||||
|
@ -198,10 +198,10 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
if (\is_string($params)) {
|
if (\is_string($params)) {
|
||||||
$this->addListener($eventName, [$subscriber, $params]);
|
$this->addListener($eventName, [$subscriber, $params]);
|
||||||
} elseif (\is_string($params[0])) {
|
} 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 {
|
} else {
|
||||||
foreach ($params as $listener) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ class Filesystem
|
|||||||
} elseif (is_dir($file)) {
|
} elseif (is_dir($file)) {
|
||||||
$this->mkdir($target);
|
$this->mkdir($target);
|
||||||
} elseif (is_file($file)) {
|
} elseif (is_file($file)) {
|
||||||
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
$this->copy($file, $target, $options['override'] ?? false);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
|
throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class DateComparator extends Comparator
|
|||||||
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
|
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) {
|
if ('since' === $operator || 'after' === $operator) {
|
||||||
$operator = '>';
|
$operator = '>';
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,6 @@ class NumberComparator extends Comparator
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->setTarget($target);
|
$this->setTarget($target);
|
||||||
$this->setOperator(isset($matches[1]) ? $matches[1] : '==');
|
$this->setOperator($matches[1] ?? '==');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,8 @@ abstract class AbstractExtension implements FormExtensionInterface
|
|||||||
$this->initTypeExtensions();
|
$this->initTypeExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset($this->typeExtensions[$name])
|
return $this->typeExtensions[$name]
|
||||||
? $this->typeExtensions[$name]
|
?? [];
|
||||||
: [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +162,7 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
|
|||||||
$label,
|
$label,
|
||||||
// The attributes may be a callable or a mapping from choice indices
|
// The attributes may be a callable or a mapping from choice indices
|
||||||
// to nested arrays
|
// 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
|
// $isPreferred may be null if no choices are preferred
|
||||||
|
@ -94,7 +94,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
|
|
||||||
private function writeData(array $data, array $options)
|
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");
|
$this->output->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class CheckboxType extends AbstractType
|
|||||||
// transformer handles this case).
|
// transformer handles this case).
|
||||||
// We cannot solve this case via overriding the "data" option, because
|
// We cannot solve this case via overriding the "data" option, because
|
||||||
// doing so also calls setDataLocked(true).
|
// 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->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.
|
$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.
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class DateIntervalType extends AbstractType
|
|||||||
'required' => $options['required'],
|
'required' => $options['required'],
|
||||||
'translation_domain' => $options['translation_domain'],
|
'translation_domain' => $options['translation_domain'],
|
||||||
// when compound the array entries are ignored, we need to cascade the configuration here
|
// 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']) {
|
if ('choice' === $options['widget']) {
|
||||||
$childOptions['choice_translation_domain'] = false;
|
$childOptions['choice_translation_domain'] = false;
|
||||||
|
@ -114,7 +114,7 @@ class DateTimeType extends AbstractType
|
|||||||
return static function (FormInterface $form) use ($emptyData, $option) {
|
return static function (FormInterface $form) use ($emptyData, $option) {
|
||||||
$emptyData = $emptyData($form->getParent());
|
$emptyData = $emptyData($form->getParent());
|
||||||
|
|
||||||
return isset($emptyData[$option]) ? $emptyData[$option] : '';
|
return $emptyData[$option] ?? '';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class DateType extends AbstractType
|
|||||||
return static function (FormInterface $form) use ($emptyData, $option) {
|
return static function (FormInterface $form) use ($emptyData, $option) {
|
||||||
$emptyData = $emptyData($form->getParent());
|
$emptyData = $emptyData($form->getParent());
|
||||||
|
|
||||||
return isset($emptyData[$option]) ? $emptyData[$option] : '';
|
return $emptyData[$option] ?? '';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class TimeType extends AbstractType
|
|||||||
if ($options['with_seconds']) {
|
if ($options['with_seconds']) {
|
||||||
// handle seconds ignored by user's browser when with_seconds enabled
|
// handle seconds ignored by user's browser when with_seconds enabled
|
||||||
// https://codereview.chromium.org/450533009/
|
// 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 {
|
} else {
|
||||||
$e->setData(sprintf('%s:%s', $matches['hours'], $matches['minutes']));
|
$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) {
|
return static function (FormInterface $form) use ($emptyData, $option) {
|
||||||
$emptyData = $emptyData($form->getParent());
|
$emptyData = $emptyData($form->getParent());
|
||||||
|
|
||||||
return isset($emptyData[$option]) ? $emptyData[$option] : '';
|
return $emptyData[$option] ?? '';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -290,9 +290,8 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
|||||||
$hash = spl_object_hash($form);
|
$hash = spl_object_hash($form);
|
||||||
|
|
||||||
$output = &$outputByHash[$hash];
|
$output = &$outputByHash[$hash];
|
||||||
$output = isset($this->dataByForm[$hash])
|
$output = $this->dataByForm[$hash]
|
||||||
? $this->dataByForm[$hash]
|
?? [];
|
||||||
: [];
|
|
||||||
|
|
||||||
$output['children'] = [];
|
$output['children'] = [];
|
||||||
|
|
||||||
@ -320,16 +319,14 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
|||||||
$output = &$outputByHash[$formHash];
|
$output = &$outputByHash[$formHash];
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = isset($this->dataByView[$viewHash])
|
$output = $this->dataByView[$viewHash]
|
||||||
? $this->dataByView[$viewHash]
|
?? [];
|
||||||
: [];
|
|
||||||
|
|
||||||
if (null !== $formHash) {
|
if (null !== $formHash) {
|
||||||
$output = array_replace(
|
$output = array_replace(
|
||||||
$output,
|
$output,
|
||||||
isset($this->dataByForm[$formHash])
|
$this->dataByForm[$formHash]
|
||||||
? $this->dataByForm[$formHash]
|
?? []
|
||||||
: []
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ class FormDataExtractor implements FormDataExtractorInterface
|
|||||||
public function extractViewVariables(FormView $view)
|
public function extractViewVariables(FormView $view)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'id' => isset($view->vars['id']) ? $view->vars['id'] : null,
|
'id' => $view->vars['id'] ?? null,
|
||||||
'name' => isset($view->vars['name']) ? $view->vars['name'] : null,
|
'name' => $view->vars['name'] ?? null,
|
||||||
'view_vars' => [],
|
'view_vars' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class MappingRule
|
|||||||
{
|
{
|
||||||
$length = \strlen($propertyPath);
|
$length = \strlen($propertyPath);
|
||||||
$prefix = substr($this->propertyPath, 0, $length);
|
$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);
|
return $prefix === $propertyPath && ('[' === $next || '.' === $next);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
|||||||
if (\count($this->typeGuessers) > 1) {
|
if (\count($this->typeGuessers) > 1) {
|
||||||
$typeGuesser = new FormTypeGuesserChain($this->typeGuessers);
|
$typeGuesser = new FormTypeGuesserChain($this->typeGuessers);
|
||||||
} else {
|
} else {
|
||||||
$typeGuesser = isset($this->typeGuessers[0]) ? $this->typeGuessers[0] : null;
|
$typeGuesser = $this->typeGuessers[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
|
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
|
||||||
|
@ -73,9 +73,8 @@ class PreloadedExtension implements FormExtensionInterface
|
|||||||
*/
|
*/
|
||||||
public function getTypeExtensions($name)
|
public function getTypeExtensions($name)
|
||||||
{
|
{
|
||||||
return isset($this->typeExtensions[$name])
|
return $this->typeExtensions[$name]
|
||||||
? $this->typeExtensions[$name]
|
?? [];
|
||||||
: [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +100,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should be decoupled from the specific option at some point
|
// 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 = $this->newBuilder($name, $dataClass, $factory, $options);
|
||||||
$builder->setType($this);
|
$builder->setType($this);
|
||||||
|
@ -51,7 +51,7 @@ class CallbackChoiceLoaderTest extends TestCase
|
|||||||
return self::$choices;
|
return self::$choices;
|
||||||
});
|
});
|
||||||
self::$value = function ($choice) {
|
self::$value = function ($choice) {
|
||||||
return isset($choice->value) ? $choice->value : null;
|
return $choice->value ?? null;
|
||||||
};
|
};
|
||||||
self::$choices = [
|
self::$choices = [
|
||||||
(object) ['value' => 'choice_one'],
|
(object) ['value' => 'choice_one'],
|
||||||
|
@ -78,7 +78,7 @@ class ViolationMapperTest extends TestCase
|
|||||||
$config = new FormConfigBuilder($name, $dataClass, $this->dispatcher, [
|
$config = new FormConfigBuilder($name, $dataClass, $this->dispatcher, [
|
||||||
'error_mapping' => $errorMapping,
|
'error_mapping' => $errorMapping,
|
||||||
] + $options);
|
] + $options);
|
||||||
$config->setMapped(isset($options['mapped']) ? $options['mapped'] : true);
|
$config->setMapped($options['mapped'] ?? true);
|
||||||
$config->setInheritData($inheritData);
|
$config->setInheritData($inheritData);
|
||||||
$config->setPropertyPath($propertyPath);
|
$config->setPropertyPath($propertyPath);
|
||||||
$config->setCompound(true);
|
$config->setCompound(true);
|
||||||
|
@ -36,7 +36,7 @@ class TestExtension implements FormExtensionInterface
|
|||||||
|
|
||||||
public function getType($name): FormTypeInterface
|
public function getType($name): FormTypeInterface
|
||||||
{
|
{
|
||||||
return isset($this->types[$name]) ? $this->types[$name] : null;
|
return $this->types[$name] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasType($name): bool
|
public function hasType($name): bool
|
||||||
@ -57,7 +57,7 @@ class TestExtension implements FormExtensionInterface
|
|||||||
|
|
||||||
public function getTypeExtensions($name): array
|
public function getTypeExtensions($name): array
|
||||||
{
|
{
|
||||||
return isset($this->extensions[$name]) ? $this->extensions[$name] : [];
|
return $this->extensions[$name] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasTypeExtensions($name): bool
|
public function hasTypeExtensions($name): bool
|
||||||
|
@ -157,7 +157,7 @@ class AcceptHeaderItem
|
|||||||
*/
|
*/
|
||||||
public function getAttribute($name, $default = null)
|
public function getAttribute($name, $default = null)
|
||||||
{
|
{
|
||||||
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
|
return $this->attributes[$name] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -821,6 +821,6 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
|
|||||||
|
|
||||||
$lcMimeType = strtolower($mimeType);
|
$lcMimeType = strtolower($mimeType);
|
||||||
|
|
||||||
return isset($this->defaultExtensions[$lcMimeType]) ? $this->defaultExtensions[$lcMimeType] : null;
|
return $this->defaultExtensions[$lcMimeType] ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ class UploadedFile extends File
|
|||||||
|
|
||||||
$errorCode = $this->error;
|
$errorCode = $this->error;
|
||||||
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
|
$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);
|
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
|
||||||
}
|
}
|
||||||
|
@ -1301,7 +1301,7 @@ class Request
|
|||||||
static::initializeFormats();
|
static::initializeFormats();
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset(static::$formats[$format]) ? static::$formats[$format] : [];
|
return static::$formats[$format] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1609,7 +1609,7 @@ class Request
|
|||||||
$preferredLanguages = $this->getLanguages();
|
$preferredLanguages = $this->getLanguages();
|
||||||
|
|
||||||
if (empty($locales)) {
|
if (empty($locales)) {
|
||||||
return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
|
return $preferredLanguages[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$preferredLanguages) {
|
if (!$preferredLanguages) {
|
||||||
@ -1629,7 +1629,7 @@ class Request
|
|||||||
|
|
||||||
$preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales));
|
$preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales));
|
||||||
|
|
||||||
return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0];
|
return $preferredLanguages[0] ?? $locales[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user