10000 minor #40727 [CS] Replace easy occurences of ?: with ?? (fancyweb) · jderusse/symfony@b946077 · GitHub
[go: up one dir, main page]

Skip to content

Commit b946077

Browse files
committed
minor symfony#40727 [CS] Replace easy occurences of ?: with ?? (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [CS] Replace easy occurences of ?: with ?? | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Since we don't support PHP 5 anymore, we can easily replace `?:` with `??` when dealing with "nullable" objects. It seems more modern to me (make the code evolve with the new language features). Once we do not support < PHP 7.4, we can replace with `??=`. Commits ------- 959d3d9 [CS] Replace easy occurences of ?: with ??
2 parents e357dbb + 959d3d9 commit b946077

File tree

58 files changed

+71
-71
lines changed

Some content is hidden

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

58 files changed

+71
-71
lines changed

src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class VarDumperFormatter implements FormatterInterface
2323

2424
public function __construct(VarCloner $cloner = null)
2525
{
26-
$this->cloner = $cloner ?: new VarCloner();
26+
$this->cloner = $cloner ?? new VarCloner();
2727
}
2828

2929
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function dump(Environment $env, $context)
8282
}
8383

8484
$dump = fopen('php://memory', 'r+');
85-
$this->dumper = $this->dumper ?: new HtmlDumper();
85+
$this->dumper = $this->dumper ?? new HtmlDumper();
8686
$this->dumper->setCharset($env->getCharset());
8787

8888
foreach ($vars as $value) {

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(CacheClearerInterface $cacheClearer, Filesystem $fil
4444
parent::__construct();
4545

4646
$this->cacheClearer = $cacheClearer;
47-
$this->filesystem = $filesystem ?: new Filesystem();
47+
$this->filesystem = $filesystem ?? new Filesystem();
4848
}
4949

5050
/**

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(ContainerInterface $container, $resource, array $opt
4949
{
5050
$this->container = $container;
5151
$this->resource = $resource;
52-
$this->context = $context ?: new RequestContext();
52+
$this->context = $context ?? new RequestContext();
5353
$this->logger = $logger;
5454
$this->setOptions($options);
5555

src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class WebProfilerExtension extends ProfilerExtension
4444

4545
public function __construct(HtmlDumper $dumper = null)
4646
{
47-
$this->dumper = $dumper ?: new HtmlDumper();
47+
$this->dumper = $dumper ?? new HtmlDumper();
4848
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
4949
}
5050

src/Symfony/Component/Asset/Package.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Package implements PackageInterface
2929
public function __construct(VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
3030
{
3131
$this->versionStrategy = $versionStrategy;
32-
$this->context = $context ?: new NullContext();
32+
$this->context = $context ?? new NullContext();
3333
}
3434

3535
/**

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ abstract class Client
5555
public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
5656
{
5757
$this->setServerParameters($server);
58-
$this->history = $history ?: new History();
59-
$this->cookieJar = $cookieJar ?: new CookieJar();
58+
$this->history = $history ?? new History();
59+
$this->cookieJar = $cookieJar ?? new CookieJar();
6060
}
6161

6262
/**

src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(string $name = null, string $type = 'array', NodeBui
2929
if (null === $name) {
3030
@trigger_error('A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.', \E_USER_DEPRECATED);
3131
} else {
32-
$builder = $builder ?: new NodeBuilder();
32+
$builder = $builder ?? new NodeBuilder();
3333
$this->root = $builder->node($name, $type)->setParent($this);
3434
}
3535
}
@@ -50,7 +50,7 @@ public function root($name, $type = 'array', NodeBuilder $builder = null)
5050
{
5151
@trigger_error(sprintf('The "%s()" method called for the "%s" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead.', __METHOD__, $name), \E_USER_DEPRECATED);
5252

53-
$builder = $builder ?: new NodeBuilder();
53+
$builder = $builder ?? new NodeBuilder();
5454

5555
return $this->root = $builder->node($name, $type)->setParent($this);
5656
}

src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class OutputFormatterStyleStack implements ResetInterface
2828

2929
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
3030
{
31-
$this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
31+
$this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
3232
$this->reset();
3333
}
3434

src/Symfony/Component/Console/Output/Output.php

Lines changed: 1 addition & 1 deletion
Original file line numberD 6CCB iff line numberDiff line change
@@ -40,7 +40,7 @@ abstract class Output implements OutputInterface
4040
public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
4141
{
4242
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
43-
$this->formatter = $formatter ?: new OutputFormatter();
43+
$this->formatter = $formatter ?? new OutputFormatter();
4444
$this->formatter->setDecorated($decorated);
4545
}
4646

0 commit comments

Comments
 (0)
0