Merge branch '5.2' into 5.x
* 5.2: [CS] Replace easy occurences of ?: with ??
This commit is contained in:
commit
855aab243d
@ -23,7 +23,7 @@ class VarDumperFormatter implements FormatterInterface
|
||||
|
||||
public function __construct(VarCloner $cloner = null)
|
||||
{
|
||||
$this->cloner = $cloner ?: new VarCloner();
|
||||
$this->cloner = $cloner ?? new VarCloner();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +74,7 @@ final class DumpExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
$dump = fopen('php://memory', 'r+');
|
||||
$this->dumper = $this->dumper ?: new HtmlDumper();
|
||||
$this->dumper = $this->dumper ?? new HtmlDumper();
|
||||
$this->dumper->setCharset($env->getCharset());
|
||||
|
||||
foreach ($vars as $value) {
|
||||
|
@ -46,7 +46,7 @@ class CacheClearCommand extends Command
|
||||
parent::__construct();
|
||||
|
||||
$this->cacheClearer = $cacheClearer;
|
||||
$this->filesystem = $filesystem ?: new Filesystem();
|
||||
$this->filesystem = $filesystem ?? new Filesystem();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->resource = $resource;
|
||||
$this->context = $context ?: new RequestContext();
|
||||
$this->context = $context ?? new RequestContext();
|
||||
$this->logger = $logger;
|
||||
$this->setOptions($options);
|
||||
|
||||
|
@ -44,7 +44,7 @@ class WebProfilerExtension extends ProfilerExtension
|
||||
|
||||
public function __construct(HtmlDumper $dumper = null)
|
||||
{
|
||||
$this->dumper = $dumper ?: new HtmlDumper();
|
||||
$this->dumper = $dumper ?? new HtmlDumper();
|
||||
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Package implements PackageInterface
|
||||
public function __construct(VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
|
||||
{
|
||||
$this->versionStrategy = $versionStrategy;
|
||||
$this->context = $context ?: new NullContext();
|
||||
$this->context = $context ?? new NullContext();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ class TreeBuilder implements NodeParentInterface
|
||||
|
||||
public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
|
||||
{
|
||||
$builder = $builder ?: new NodeBuilder();
|
||||
$builder = $builder ?? new NodeBuilder();
|
||||
$this->root = $builder->node($name, $type)->setParent($this);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
|
||||
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
|
||||
{
|
||||
$this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
|
||||
$this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ abstract class Output implements OutputInterface
|
||||
public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
|
||||
$this->formatter = $formatter ?: new OutputFormatter();
|
||||
$this->formatter = $formatter ?? new OutputFormatter();
|
||||
$this->formatter->setDecorated($decorated);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Parser implements ParserInterface
|
||||
|
||||
public function __construct(Tokenizer $tokenizer = null)
|
||||
{
|
||||
$this->tokenizer = $tokenizer ?: new Tokenizer();
|
||||
$this->tokenizer = $tokenizer ?? new Tokenizer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class Translator implements TranslatorInterface
|
||||
|
||||
public function __construct(ParserInterface $parser = null)
|
||||
{
|
||||
$this->mainParser = $parser ?: new Parser();
|
||||
$this->mainParser = $parser ?? new Parser();
|
||||
|
||||
$this
|
||||
->registerExtension(new Extension\NodeExtension())
|
||||
|
@ -64,7 +64,7 @@ class Container implements ContainerInterface, ResetInterface
|
||||
|
||||
public function __construct(ParameterBagInterface $parameterBag = null)
|
||||
{
|
||||
$this->parameterBag = $parameterBag ?: new EnvPlaceholderParameterBag();
|
||||
$this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -363,7 +363,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
|
||||
if ($this->trackResources) {
|
||||
if (!$classReflector) {
|
||||
$this->addResource($resource ?: new ClassExistenceResource($class, false));
|
||||
$this->addResource($resource ?? new ClassExistenceResource($class, false));
|
||||
} elseif (!$classReflector->isInternal()) {
|
||||
$path = $classReflector->getFileName();
|
||||
|
||||
|
@ -176,7 +176,7 @@ class IntegrationTest extends TestCase
|
||||
public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ContainerBuilder $mainContainer = null)
|
||||
{
|
||||
// allow a container to be passed in, which might have autoconfigure settings
|
||||
$container = $mainContainer ?: new ContainerBuilder();
|
||||
$container = $mainContainer ?? new ContainerBuilder();
|
||||
$container->setResourceTracking(false);
|
||||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Fixtures/yaml/integration/'.$directory));
|
||||
$loader->load('main.yml');
|
||||
|
@ -36,7 +36,7 @@ class ExpressionLanguage
|
||||
*/
|
||||
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
|
||||
{
|
||||
$this->cache = $cache ?: new ArrayAdapter();
|
||||
$this->cache = $cache ?? new ArrayAdapter();
|
||||
$this->registerFunctions();
|
||||
foreach ($providers as $provider) {
|
||||
$this->registerProvider($provider);
|
||||
|
@ -35,7 +35,7 @@ class CoreExtension extends AbstractExtension
|
||||
public function __construct(PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null, TranslatorInterface $translator = null)
|
||||
{
|
||||
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
|
||||
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
|
||||
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
|
||||
|
||||
$this->fields = $fields;
|
||||
$this->pad = $pad;
|
||||
$this->referenceDate = $referenceDate ?: new \DateTimeImmutable('1970-01-01 00:00:00');
|
||||
$this->referenceDate = $referenceDate ?? new \DateTimeImmutable('1970-01-01 00:00:00');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ class ChoiceType extends AbstractType
|
||||
*/
|
||||
public function __construct(ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
|
||||
{
|
||||
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(
|
||||
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(
|
||||
new PropertyAccessDecorator(
|
||||
new DefaultChoiceListFactory()
|
||||
)
|
||||
|
@ -48,7 +48,7 @@ class CsrfValidationListener implements EventSubscriberInterface
|
||||
$this->errorMessage = $errorMessage;
|
||||
$this->translator = $translator;
|
||||
$this->translationDomain = $translationDomain;
|
||||
$this->serverParams = $serverParams ?: new ServerParams();
|
||||
$this->serverParams = $serverParams ?? new ServerParams();
|
||||
}
|
||||
|
||||
public function preSubmit(FormEvent $event)
|
||||
|
@ -32,7 +32,7 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
|
||||
|
||||
public function __construct(ServerParams $serverParams = null)
|
||||
{
|
||||
$this->serverParams = $serverParams ?: new ServerParams();
|
||||
$this->serverParams = $serverParams ?? new ServerParams();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension
|
||||
|
||||
public function __construct(RequestHandlerInterface $requestHandler = null)
|
||||
{
|
||||
$this->requestHandler = $requestHandler ?: new HttpFoundationRequestHandler();
|
||||
$this->requestHandler = $requestHandler ?? new HttpFoundationRequestHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,7 +180,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
|
||||
}
|
||||
|
||||
$registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory());
|
||||
$registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?? new ResolvedFormTypeFactory());
|
||||
|
||||
return new FormFactory($registry);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class NativeRequestHandler implements RequestHandlerInterface
|
||||
|
||||
public function __construct(ServerParams $params = null)
|
||||
{
|
||||
$this->serverParams = $params ?: new ServerParams();
|
||||
$this->serverParams = $params ?? new ServerParams();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,14 +39,14 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
|
||||
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
|
||||
{
|
||||
$this->storage = $storage ?: new NativeSessionStorage();
|
||||
$this->storage = $storage ?? new NativeSessionStorage();
|
||||
$this->usageReporter = $usageReporter;
|
||||
|
||||
$attributes = $attributes ?: new AttributeBag();
|
||||
$attributes = $attributes ?? new AttributeBag();
|
||||
$this->attributeName = $attributes->getName();
|
||||
$this->registerBag($attributes);
|
||||
|
||||
$flashes = $flashes ?: new FlashBag();
|
||||
$flashes = $flashes ?? new FlashBag();
|
||||
$this->flashName = $flashes->getName();
|
||||
$this->registerBag($flashes);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
|
||||
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
|
||||
{
|
||||
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
|
||||
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
|
||||
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
$this->requestStack = $requestStack ?: new RequestStack();
|
||||
$this->requestStack = $requestStack ?? new RequestStack();
|
||||
$this->argumentResolver = $argumentResolver;
|
||||
|
||||
if (null === $this->argumentResolver) {
|
||||
|
@ -158,7 +158,7 @@ class TestSessionListenerTest extends TestCase
|
||||
private function filterResponse(Request $request, $type = HttpKernelInterface::MAIN_REQUEST, Response $response = null)
|
||||
{
|
||||
$request->setSession($this->session);
|
||||
$response = $response ?: new Response();
|
||||
$response = $response ?? new Response();
|
||||
$kernel = $this->createMock(HttpKernelInterface::class);
|
||||
$event = new ResponseEvent($kernel, $request, $type, $response);
|
||||
|
||||
|
@ -35,7 +35,7 @@ abstract class AbstractTransport implements TransportInterface
|
||||
public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
|
||||
{
|
||||
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
|
||||
$this->logger = $logger ?: new NullLogger();
|
||||
$this->logger = $logger ?? new NullLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ class SmtpTransport extends AbstractTransport
|
||||
{
|
||||
parent::__construct($dispatcher, $logger);
|
||||
|
||||
$this->stream = $stream ?: new SocketStream();
|
||||
$this->stream = $stream ?? new SocketStream();
|
||||
}
|
||||
|
||||
public function getStream(): AbstractStream
|
||||
|
@ -54,8 +54,8 @@ class AmqpTransportTest extends TestCase
|
||||
|
||||
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): AmqpTransport
|
||||
{
|
||||
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?: $this->createMock(Connection::class);
|
||||
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?? $this->createMock(Connection::class);
|
||||
|
||||
return new AmqpTransport($connection, $serializer);
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ final class BeanstalkdTransportTest extends TestCase
|
||||
|
||||
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): BeanstalkdTransport
|
||||
{
|
||||
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?: $this->createMock(Connection::class);
|
||||
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?? $this->createMock(Connection::class);
|
||||
|
||||
return new BeanstalkdTransport($connection, $serializer);
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ class RedisTransportTest extends TestCase
|
||||
|
||||
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): RedisTransport
|
||||
{
|
||||
$serializer = $serializer ?: $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?: $this->createMock(Connection::class);
|
||||
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
|
||||
$connection = $connection ?? $this->createMock(Connection::class);
|
||||
|
||||
return new RedisTransport($connection, $serializer);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class Router implements RouterInterface, RequestMatcherInterface
|
||||
$this->loader = $loader;
|
||||
$this->resource = $resource;
|
||||
$this->logger = $logger;
|
||||
$this->context = $context ?: new RequestContext();
|
||||
$this->context = $context ?? new RequestContext();
|
||||
$this->setOptions($options);
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class CompiledRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
|
||||
$compiledRoutes = $dumper->getCompiledRoutes();
|
||||
|
||||
return $this->getMockBuilder(TestCompiledRedirectableUrlMatcher::class)
|
||||
->setConstructorArgs([$compiledRoutes, $context ?: new RequestContext()])
|
||||
->setConstructorArgs([$compiledRoutes, $context ?? new RequestContext()])
|
||||
->setMethods(['redirect'])
|
||||
->getMock();
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ class CompiledUrlMatcherTest extends UrlMatcherTest
|
||||
{
|
||||
$dumper = new CompiledUrlMatcherDumper($routes);
|
||||
|
||||
return new CompiledUrlMatcher($dumper->getCompiledRoutes(), $context ?: new RequestContext());
|
||||
return new CompiledUrlMatcher($dumper->getCompiledRoutes(), $context ?? new RequestContext());
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,6 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
|
||||
|
||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||
{
|
||||
return $this->getMockForAbstractClass(RedirectableUrlMatcher::class, [$routes, $context ?: new RequestContext()]);
|
||||
return $this->getMockForAbstractClass(RedirectableUrlMatcher::class, [$routes, $context ?? new RequestContext()]);
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +121,6 @@ class TraceableUrlMatcherTest extends UrlMatcherTest
|
||||
|
||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||
{
|
||||
return new TraceableUrlMatcher($routes, $context ?: new RequestContext());
|
||||
return new TraceableUrlMatcher($routes, $context ?? new RequestContext());
|
||||
}
|
||||
}
|
||||
|
@ -943,6 +943,6 @@ class UrlMatcherTest extends TestCase
|
||||
|
||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||
{
|
||||
return new UrlMatcher($routes, $context ?: new RequestContext());
|
||||
return new UrlMatcher($routes, $context ?? new RequestContext());
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ class CsrfTokenManager implements CsrfTokenManagerInterface
|
||||
*/
|
||||
public function __construct(TokenGeneratorInterface $generator = null, TokenStorageInterface $storage = null, $namespace = null)
|
||||
{
|
||||
$this->generator = $generator ?: new UriSafeTokenGenerator();
|
||||
$this->storage = $storage ?: new NativeSessionTokenStorage();
|
||||
$this->generator = $generator ?? new UriSafeTokenGenerator();
|
||||
$this->storage = $storage ?? new NativeSessionTokenStorage();
|
||||
|
||||
$superGlobalNamespaceGenerator = function () {
|
||||
return !empty($_SERVER['HTTPS']) && 'off' !== strtolower($_SERVER['HTTPS']) ? 'https-' : '';
|
||||
|
@ -69,7 +69,7 @@ class ContextListener extends AbstractListener
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
|
||||
|
||||
$this->trustResolver = $trustResolver ?: new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
|
||||
$this->trustResolver = $trustResolver ?? new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
|
||||
$this->sessionTrackerEnabler = $sessionTrackerEnabler;
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ class ContextListenerTest extends TestCase
|
||||
|
||||
private function handleEventWithPreviousSession($userProviders, UserInterface $user = null, RememberMeServicesInterface $rememberMeServices = null)
|
||||
{
|
||||
$tokenUser = $user ?: new InMemoryUser('foo', 'bar');
|
||||
$tokenUser = $user ?? new InMemoryUser('foo', 'bar');
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$session->set('_security_context_key', serialize(new UsernamePasswordToken($tokenUser, '', 'context_key', ['ROLE_USER'])));
|
||||
|
||||
|
@ -184,7 +184,7 @@ class ExceptionListenerTest extends TestCase
|
||||
private function createEntryPoint(Response $response = null)
|
||||
{
|
||||
$entryPoint = $this->createMock(AuthenticationEntryPointInterface::class);
|
||||
$entryPoint->expects($this->once())->method('start')->willReturn($response ?: new Response('OK'));
|
||||
$entryPoint->expects($this->once())->method('start')->willReturn($response ?? new Response('OK'));
|
||||
|
||||
return $entryPoint;
|
||||
}
|
||||
@ -209,9 +209,9 @@ class ExceptionListenerTest extends TestCase
|
||||
private function createExceptionListener(TokenStorageInterface $tokenStorage = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
|
||||
{
|
||||
return new ExceptionListener(
|
||||
$tokenStorage ?: $this->createMock(TokenStorageInterface::class),
|
||||
$trustResolver ?: $this->createMock(AuthenticationTrustResolverInterface::class),
|
||||
$httpUtils ?: $this->createMock(HttpUtils::class),
|
||||
$tokenStorage ?? $this->createMock(TokenStorageInterface::class),
|
||||
$trustResolver ?? $this->createMock(AuthenticationTrustResolverInterface::class),
|
||||
$httpUtils ?? $this->createMock(HttpUtils::class),
|
||||
'key',
|
||||
$authenticationEntryPoint,
|
||||
$errorPage,
|
||||
|
@ -25,8 +25,8 @@ class JsonEncoder implements EncoderInterface, DecoderInterface
|
||||
|
||||
public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodingImpl = null)
|
||||
{
|
||||
$this->encodingImpl = $encodingImpl ?: new JsonEncode();
|
||||
$this->decodingImpl = $decodingImpl ?: new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
|
||||
$this->encodingImpl = $encodingImpl ?? new JsonEncode();
|
||||
$this->decodingImpl = $decodingImpl ?? new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,8 @@ class YamlEncoder implements EncoderInterface, DecoderInterface
|
||||
throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.');
|
||||
}
|
||||
|
||||
$this->dumper = $dumper ?: new Dumper();
|
||||
$this->parser = $parser ?: new Parser();
|
||||
$this->dumper = $dumper ?? new Dumper();
|
||||
$this->parser = $parser ?? new Parser();
|
||||
$this->defaultContext = array_merge($this->defaultContext, $defaultContext);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, Se
|
||||
*/
|
||||
public function denormalize($data, string $type, string $format = null, array $context = [])
|
||||
{
|
||||
$object = $this->extractObjectToPopulate($type, $context) ?: new $type();
|
||||
$object = $this->extractObjectToPopulate($type, $context) ?? new $type();
|
||||
$object->denormalize($this->serializer, $data, $format, $context);
|
||||
|
||||
return $object;
|
||||
|
@ -407,7 +407,7 @@ class ValidatorBuilder
|
||||
$metadataFactory = new LazyLoadingMetadataFactory($loader, $this->mappingCache);
|
||||
}
|
||||
|
||||
$validatorFactory = $this->validatorFactory ?: new ConstraintValidatorFactory();
|
||||
$validatorFactory = $this->validatorFactory ?? new ConstraintValidatorFactory();
|
||||
$translator = $this->translator;
|
||||
|
||||
if (null === $translator) {
|
||||
|
@ -44,7 +44,7 @@ final class Definition
|
||||
|
||||
$this->setInitialPlaces($initialPlaces);
|
||||
|
||||
$this->metadataStore = $metadataStore ?: new InMemoryMetadataStore();
|
||||
$this->metadataStore = $metadataStore ?? new InMemoryMetadataStore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ final class InMemoryMetadataStore implements MetadataStoreInterface
|
||||
{
|
||||
$this->workflowMetadata = $workflowMetadata;
|
||||
$this->placesMetadata = $placesMetadata;
|
||||
$this->transitionsMetadata = $transitionsMetadata ?: new \SplObjectStorage();
|
||||
$this->transitionsMetadata = $transitionsMetadata ?? new \SplObjectStorage();
|
||||
}
|
||||
|
||||
public function getWorkflowMetadata(): array
|
||||
|
@ -22,6 +22,6 @@ class StateMachine extends Workflow
|
||||
{
|
||||
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed')
|
||||
{
|
||||
parent::__construct($definition, $markingStore ?: new MethodMarkingStore(true), $dispatcher, $name);
|
||||
parent::__construct($definition, $markingStore ?? new MethodMarkingStore(true), $dispatcher, $name);
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class GuardListenerTest extends TestCase
|
||||
private function createEvent(Transition $transition = null)
|
||||
{
|
||||
$subject = new Subject();
|
||||
$transition = $transition ?: new Transition('name', 'from', 'to');
|
||||
$transition = $transition ?? new Transition('name', 'from', 'to');
|
||||
|
||||
$workflow = $this->createMock(WorkflowInterface::class);
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Workflow implements WorkflowInterface
|
||||
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', array $eventsToDispatch = null)
|
||||
{
|
||||
$this->definition = $definition;
|
||||
$this->markingStore = $markingStore ?: new MethodMarkingStore();
|
||||
$this->markingStore = $markingStore ?? new MethodMarkingStore();
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->name = $name;
|
||||
$this->eventsToDispatch = $eventsToDispatch;
|
||||
|
Reference in New Issue
Block a user