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

Skip to content

Commit b946077

Browse files
committed
minor #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

D7AE

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff 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

src/Symfony/Component/CssSelector/Parser/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Parser implements ParserInterface
3131

3232
public function __construct(Tokenizer $tokenizer = null)
3333
{
34-
$this->tokenizer = $tokenizer ?: new Tokenizer();
34+
$this->tokenizer = $tokenizer ?? new Tokenizer();
3535
}
3636

3737
/**

src/Symfony/Component/CssSelector/XPath/Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Translator implements TranslatorInterface
5050

5151
public function __construct(ParserInterface $parser = null)
5252
{
53-
$this->mainParser = $parser ?: new Parser();
53+
$this->mainParser = $parser ?? new Parser();
5454

5555
$this
5656
->registerExtension(new Extension\NodeExtension())

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Container implements ResettableContainerInterface
6464

6565
public function __construct(ParameterBagInterface $parameterBag = null)
6666
{
67-
$this->parameterBag = $parameterBag ?: new EnvPlaceholderParameterBag();
67+
$this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag();
6868
}
6969

7070
/**

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public function getReflectionClass(?string $class, bool $throw = true): ?\Reflec
362362

363363
if ($this->trackResources) {
364364
if (!$classReflector) {
365-
$this->addResource($resource ?: new ClassExistenceResource($class, false));
365+
$this->addResource($resource ?? new ClassExistenceResource($class, false));
366366
} elseif (!$classReflector->isInternal()) {
367367
$path = $classReflector->getFileName();
368368

src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function testCanDecorateServiceLocator()
173173
public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ContainerBuilder $mainContainer = null)
174174
{
175175
// allow a container to be passed in, which might have autoconfigure settings
176-
$container = $mainContainer ?: new ContainerBuilder();
176+
$container = $mainContainer ?? new ContainerBuilder();
177177
$container->setResourceTracking(false);
178178
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Fixtures/yaml/integration/'.$directory));
179179
$loader->load('main.yml');

src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ExpressionLanguage
3333
*/
3434
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
3535
{
36-
$this->cache = $cache ?: new ArrayAdapter();
36+
$this->cache = $cache ?? new ArrayAdapter();
3737
$this->registerFunctions();
3838
foreach ($providers as $provider) {
3939
$this->registerProvider($provider);

src/Symfony/Component/Form/Extension/Core/CoreExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(PropertyAccessorInterface $propertyAccessor = null,
4242
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
4343
}
4444
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
45-
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
45+
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
4646
$this->translator = $translator;
4747
}
4848

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(string $inputTimezone = null, string $outputTimezone
4242

4343
$this->fields = $fields;
4444
$this->pad = $pad;
45-
$this->referenceDate = $referenceDate ?: new \DateTimeImmutable('1970-01-01 00:00:00');
45+
$this->referenceDate = $referenceDate ?? new \DateTimeImmutable('1970-01-01 00:00:00');
4646
}
4747

4848
/**

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ChoiceType extends AbstractType
4949
*/
5050
public function __construct(ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
5151
{
52-
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(
52+
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(
5353
new PropertyAccessDecorator(
5454
new DefaultChoiceListFactory()
5555
)

src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenM
5555
$this->errorMessage = $errorMessage;
5656
$this->translator = $translator;
5757
$this->translationDomain = $translationDomain;
58-
$this->serverParams = $serverParams ?: new ServerParams();
58+
$this->serverParams = $serverParams ?? new ServerParams();
5959
}
6060

6161
public function preSubmit(FormEvent $event)

src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
3232

3333
public function __construct(ServerParams $serverParams = null)
3434
{
35-
$this->serverParams = $serverParams ?: new ServerParams();
35+
$this->serverParams = $serverParams ?? new ServerParams();
3636
}
3737

3838
/**

src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension
2626

2727
public function __construct(RequestHandlerInterface $requestHandler = null)
2828
{
29-
$this->requestHandler = $requestHandler ?: new HttpFoundationRequestHandler();
29+
$this->requestHandler = $requestHandler ?? new HttpFoundationRequestHandler();
3030
}
3131

3232
/**

src/Symfony/Component/Form/FormFactoryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getFormFactory()
184184
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
185185
}
186186

187-
$registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory());
187+
$registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?? new ResolvedFormTypeFactory());
188188

189189
return new FormFactory($registry);
190190
}

src/Symfony/Component/Form/NativeRequestHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class NativeRequestHandler implements RequestHandlerInterface
3636

3737
public function __construct(ServerParams $params = null)
3838
{
39-
$this->serverParams = $params ?: new ServerParams();
39+
$this->serverParams = $params ?? new ServerParams();
4040
}
4141

4242
/**

src/Symfony/Component/HttpFoundation/Session/Session.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
3838

3939
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
4040
{
41-
$this->storage = $storage ?: new NativeSessionStorage();
41+
$this->storage = $storage ?? new NativeSessionStorage();
4242

43-
$attributes = $attributes ?: new AttributeBag();
43+
$attributes = $attributes ?? new AttributeBag();
4444
$this->attributeName = $attributes->getName();
4545
$this->registerBag($attributes);
4646

47-
$flashes = $flashes ?: new FlashBag();
47+
$flashes = $flashes ?? new FlashBag();
4848
$this->flashName = $flashes->getName();
4949
$this->registerBag($flashes);
5050
}

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
3636

3737
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
3838
{
39-
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
39+
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
4040
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
4141
}
4242

src/Symfony/Component/HttpKernel/HttpKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
6161
{
6262
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
6363
$this->resolver = $resolver;
64-
$this->requestStack = $requestStack ?: new RequestStack();
64+
$this->requestStack = $requestStack ?? new RequestStack();
6565
$this->argumentResolver = $argumentResolver;
6666

6767
if (null === $this->argumentResolver) {

src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function testDoesNotThrowIfRequestDoesNotHaveASession()
158158
private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, Response $response = null)
159159
{
160160
$request->setSession($this->session);
161-
$response = $response ?: new Response();
161+
$response = $response ?? new Response();
162162
$kernel = $this->createMock(HttpKernelInterface::class);
163163
$event = new ResponseEvent($kernel, $request, $type, $response);
164164

src/Symfony/Component/Mailer/Transport/AbstractTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AbstractTransport implements TransportInterface
3434
public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
3535
{
3636
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
37-
$this->logger = $logger ?: new NullLogger();
37+
$this->logger = $logger ?? new NullLogger();
3838
}
3939

4040
/**

src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(AbstractStream $stream = null, EventDispatcherInterf
4444
{
4545
parent::__construct($dispatcher, $logger);
4646

47-
$this->stream = $stream ?: new SocketStream();
47+
$this->stream = $stream ?? new SocketStream();
4848
}
4949

5050
public function getStream(): AbstractStream

src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpTransportTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public function testReceivesMessages()
5454

5555
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): AmqpTransport
5656
{
57-
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
58-
$connection = $connection ?: $this->createMock(Connection::class);
57+
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
58+
$connection = $connection ?? $this->createMock(Connection::class);
5959

6060
return new AmqpTransport($connection, $serializer);
6161
}

src/Symfony/Component/Messenger/Tests/Transport/Doctrine/DoctrineTransportTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function testReceivesMessages()
5252

5353
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): DoctrineTransport
5454
{
55-
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
56-
$connection = $connection ?: $this->createMock(Connection::class);
55+
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
56+
$connection = $connection ?? $this->createMock(Connection::class);
5757

5858
return new DoctrineTransport($connection, $serializer);
5959
}

src/Symfony/Component/Messenger/Tests/Transport/RedisExt/RedisTransportTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function testReceivesMessages()
5252

5353
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): RedisTransport
5454
{
55-
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
56-
$connection = $connection ?: $this->createMock(Connection::class);
55+
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
56+
$connection = $connection ?? $this->createMock(Connection::class);
5757

5858
return new RedisTransport($connection, $serializer);
5959
}

src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
7171
], $connectionOptions);
7272
$this->exchangeOptions = $exchangeOptions;
7373
$this->queuesOptions = $queuesOptions;
74-
$this->amqpFactory = $amqpFactory ?: new AmqpFactory();
74+
$this->amqpFactory = $amqpFactory ?? new AmqpFactory();
7575
}
7676

7777
/**

src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(array $configuration, array $connectionCredentials =
5151
throw new LogicException('The redis transport requires php-redis 4.3.0 or higher.');
5252
}
5353

54-
$this->connection = $redis ?: new \Redis();
54+
$this->connection = $redis ?? new \Redis();
5555
$this->connection->connect($connectionCredentials['host'] ?? '127.0.0.1', $connectionCredentials['port'] ?? 6379);
5656
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
5757

src/Symfony/Component/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function __construct(LoaderInterface $loader, $resource, array $options =
107107
$this->loader = $loader;
108108
$this->resource = $resource;
109109
$this->logger = $logger;
110-
$this->context = $context ?: new RequestContext();
110+
$this->context = $context ?? new RequestContext();
111111
$this->setOptions($options);
112112
$this->defaultLocale = $defaultLocale;
113113
}

src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
2525
$compiledRoutes = $dumper->getCompiledRoutes();
2626

2727
return $this->getMockBuilder(TestCompiledRedirectableUrlMatcher::class)
28-
->setConstructorArgs([$compiledRoutes, $context ?: new RequestContext()])
28+
->setConstructorArgs([$compiledRoutes, $context ?? new RequestContext()])
2929
->setMethods(['redirect'])
3030
->getMock();
3131
}

src/Symfony/Component/Routing/Tests/Matcher/CompiledUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
2222
{
2323
$dumper = new CompiledUrlMatcherDumper($routes);
2424

25-
return new CompiledUrlMatcher($dumper->getCompiledRoutes(), $context ?: new RequestContext());
25+
return new CompiledUrlMatcher($dumper->getCompiledRoutes(), $context ?? new RequestContext());
2626
}
2727
}

src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
3131
eval('?>'.$dumper->dump(['class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher']));
3232

3333
return $this->getMockBuilder($class)
34-
->setConstructorArgs([$context ?: new RequestContext()])
34+
->setConstructorArgs([$context ?? new RequestContext()])
3535
->setMethods(['redirect'])
3636
->getMock();
3737
}

src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
2828
$dumper = new PhpMatcherDumper($routes);
2929
eval('?>'.$dumper->dump(['class' => $class]));
3030

31-
return new $class($context ?: new RequestContext());
31+
return new $class($context ?? new RequestContext());
3232
}
3333
}

src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,6 @@ public function testTrailingRequirementWithDefault_A()
211211

212212
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
213213
{
214-
return $this->getMockForAbstractClass(RedirectableUrlMatcher::class, [$routes, $context ?: new RequestContext()]);
214+
return $this->getMockForAbstractClass(RedirectableUrlMatcher::class, [$routes, $context ?? new RequestContext()]);
215215
}
216216
}

src/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ public function testRoutesWithConditions()
121121

122122
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
123123
{
124-
return new TraceableUrlMatcher($routes, $context ?: new RequestContext());
124+
return new TraceableUrlMatcher($routes, $context ?? new RequestContext());
125125
}
126126
}

0 commit comments

Comments
 (0)
0