Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4 syntax in bundles vol.2 #13039

Merged
merged 2 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Sylius\Bundle\CoreBundle\Application;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

/**
* @mixin \Symfony\Component\HttpKernel\Bundle\Bundle
* @mixin Bundle
*
* @see \Symfony\Component\HttpKernel\Bundle\Bundle
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@

final class CheckoutRedirectListener
{
/** @var RequestStack */
private $requestStack;
private RequestStack $requestStack;

/** @var CheckoutStateUrlGeneratorInterface */
private $checkoutStateUrlGenerator;
private CheckoutStateUrlGeneratorInterface $checkoutStateUrlGenerator;

/** @var RequestMatcherInterface */
private $requestMatcher;
private RequestMatcherInterface $requestMatcher;

public function __construct(
RequestStack $requestStack,
Expand Down
12 changes: 4 additions & 8 deletions src/Sylius/Bundle/CoreBundle/Checkout/CheckoutResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,13 @@

final class CheckoutResolver implements EventSubscriberInterface
{
/** @var CartContextInterface */
private $cartContext;
private CartContextInterface $cartContext;

/** @var CheckoutStateUrlGeneratorInterface */
private $urlGenerator;
private CheckoutStateUrlGeneratorInterface $urlGenerator;

/** @var RequestMatcherInterface */
private $requestMatcher;
private RequestMatcherInterface $requestMatcher;

/** @var FactoryInterface */
private $stateMachineFactory;
private FactoryInterface $stateMachineFactory;

public function __construct(
CartContextInterface $cartContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

final class CheckoutStateUrlGenerator implements CheckoutStateUrlGeneratorInterface
{
/** @var RouterInterface */
private $router;
private RouterInterface $router;

/** @var array */
private $routeCollection = [];
private array $routeCollection = [];

public function __construct(RouterInterface $router, array $routeCollection)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Sylius/Bundle/CoreBundle/Collector/CartCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*/
final class CartCollector extends DataCollector
{
/** @var CartContextInterface */
private $cartContext;
private CartContextInterface $cartContext;

public function __construct(CartContextInterface $cartContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

final class SyliusCollector extends DataCollector
{
/** @var ShopperContextInterface */
private $shopperContext;
private ShopperContextInterface $shopperContext;

public function __construct(
ShopperContextInterface $shopperContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ abstract class AbstractInstallCommand extends ContainerAwareCommand
/** @deprecated */
public const WEB_MEDIA_IMAGE_DIRECTORY = 'web/media/image/';

/** @var CommandExecutor */
protected $commandExecutor;
protected ?CommandExecutor $commandExecutor = null;

protected function initialize(InputInterface $input, OutputInterface $output)
{
Expand Down
11 changes: 5 additions & 6 deletions src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ final class InstallCommand extends AbstractInstallCommand
{
protected static $defaultName = 'sylius:install';

/**
* @var array
*
* @psalm-var non-empty-list
*/
private $commands = [
private array $commands = [
[
'command' => 'check-requirements',
'message' => 'Checking system requirements.',
Expand Down Expand Up @@ -71,6 +66,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->ensureDirectoryExistsAndIsWritable((string) $this->getContainer()->getParameter('kernel.cache_dir'), $output);

$errored = false;
/**
* @var int $step
* @var array $command
*/
foreach ($this->commands as $step => $command) {
try {
$outputStyle->newLine();
Expand Down
9 changes: 3 additions & 6 deletions src/Sylius/Bundle/CoreBundle/Command/Model/PluginInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@

final class PluginInfo
{
/** @var string */
private $name;
private string $name;

/** @var string */
private $description;
private string $description;

/** @var string */
private $url;
private string $url;

public function __construct(string $name, string $description, string $url)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class ShowAvailablePluginsCommand extends Command
* @phpstan-var ArrayCollection<PluginInfo>
* @psalm-var ArrayCollection<array-key, PluginInfo>
*/
private $plugins;
private ArrayCollection $plugins;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private ArrayCollection $plugins;
private Collection $plugins;

?


protected function configure(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@

final class CustomerAndChannelBasedCartContext implements CartContextInterface
{
/** @var CustomerContextInterface */
private $customerContext;
private CustomerContextInterface $customerContext;

/** @var ChannelContextInterface */
private $channelContext;
private ChannelContextInterface $channelContext;

/** @var OrderRepositoryInterface */
private $orderRepository;
private OrderRepositoryInterface $orderRepository;

public function __construct(
CustomerContextInterface $customerContext,
Expand Down
6 changes: 2 additions & 4 deletions src/Sylius/Bundle/CoreBundle/Context/CustomerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

final class CustomerContext implements CustomerContextInterface
{
/** @var TokenStorageInterface */
private $tokenStorage;
private TokenStorageInterface $tokenStorage;

/** @var AuthorizationCheckerInterface */
private $authorizationChecker;
private AuthorizationCheckerInterface $authorizationChecker;

public function __construct(TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

final class SessionAndChannelBasedCartContext implements CartContextInterface
{
/** @var CartStorageInterface */
private $cartStorage;
private CartStorageInterface $cartStorage;

/** @var ChannelContextInterface */
private $channelContext;
private ChannelContextInterface $channelContext;

public function __construct(CartStorageInterface $cartStorage, ChannelContextInterface $channelContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ final class SyliusCoreExtension extends AbstractResourceExtension implements Pre
{
use PrependDoctrineMigrationsTrait;

/** @var array */
private static $bundles = [
private static array $bundles = [
'sylius_addressing',
'sylius_attribute',
'sylius_channel',
Expand Down
7 changes: 3 additions & 4 deletions src/Sylius/Bundle/CoreBundle/Doctrine/DQL/DateFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\DQL;

use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\AST\ArithmeticExpression;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
Expand All @@ -21,11 +22,9 @@

final class DateFormat extends FunctionNode
{
/** @var ArithmeticExpression|null */
public $date;
public ?ArithmeticExpression $date = null;

/** @var ArithmeticExpression|null */
public $pattern;
public ?Node $pattern = null;

public function parse(Parser $parser)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use SyliusLabs\AssociationHydrator\AssociationHydrator;

class AttributeRepository extends EntityRepository
{
/** @var AssociationHydrator */
protected $associationHydrator;
protected AssociationHydrator $associationHydrator;

public function __construct(EntityManager $entityManager, Mapping\ClassMetadata $class)
public function __construct(EntityManager $entityManager, ClassMetadata $class)
{
parent::__construct($entityManager, $class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

final class ResourceDeleteHandler implements ResourceDeleteHandlerInterface
{
/** @var ResourceDeleteHandlerInterface */
private $decoratedHandler;
private ResourceDeleteHandlerInterface $decoratedHandler;

/** @var EntityManagerInterface */
private $entityManager;
private EntityManagerInterface $entityManager;

public function __construct(ResourceDeleteHandlerInterface $decoratedHandler, EntityManagerInterface $entityManager)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class ResourceUpdateHandler implements ResourceUpdateHandlerInterface
{
/** @var ResourceUpdateHandlerInterface */
private $decoratedHandler;
private ResourceUpdateHandlerInterface $decoratedHandler;

public function __construct(ResourceUpdateHandlerInterface $decoratedHandler)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

final class OrderInventoryOperator implements OrderInventoryOperatorInterface
{
/** @var OrderInventoryOperatorInterface */
private $decoratedOperator;
private OrderInventoryOperatorInterface $decoratedOperator;

/** @var EntityManagerInterface */
private $productVariantManager;
private EntityManagerInterface $productVariantManager;

public function __construct(
OrderInventoryOperatorInterface $decoratedOperator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\QueryBuilder;
Expand All @@ -29,10 +30,9 @@

class OrderRepository extends BaseOrderRepository implements OrderRepositoryInterface
{
/** @var AssociationHydrator */
protected $associationHydrator;
protected AssociationHydrator $associationHydrator;

public function __construct(EntityManager $entityManager, Mapping\ClassMetadata $class)
public function __construct(EntityManager $entityManager, ClassMetadata $class)
{
parent::__construct($entityManager, $class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping;
use Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionRepository as BaseProductOptionRepository;
use SyliusLabs\AssociationHydrator\AssociationHydrator;

class ProductOptionRepository extends BaseProductOptionRepository
{
/** @var AssociationHydrator */
protected $associationHydrator;
protected AssociationHydrator $associationHydrator;

public function __construct(EntityManager $entityManager, Mapping\ClassMetadata $class)
public function __construct(EntityManager $entityManager, ClassMetadata $class)
{
parent::__construct($entityManager, $class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\QueryBuilder;
Expand All @@ -25,10 +26,9 @@

class ProductRepository extends BaseProductRepository implements ProductRepositoryInterface
{
/** @var AssociationHydrator */
private $associationHydrator;
private AssociationHydrator $associationHydrator;

public function __construct(EntityManager $entityManager, Mapping\ClassMetadata $class)
public function __construct(EntityManager $entityManager, ClassMetadata $class)
{
parent::__construct($entityManager, $class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping;
use Sylius\Bundle\PromotionBundle\Doctrine\ORM\PromotionRepository as BasePromotionRepository;
Expand All @@ -22,10 +23,9 @@

class PromotionRepository extends BasePromotionRepository implements PromotionRepositoryInterface
{
/** @var AssociationHydrator */
private $associationHydrator;
private AssociationHydrator $associationHydrator;

public function __construct(EntityManager $entityManager, Mapping\ClassMetadata $class)
public function __construct(EntityManager $entityManager, ClassMetadata $class)
{
parent::__construct($entityManager, $class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

final class CanonicalizerListener
{
/** @var CanonicalizerInterface */
private $canonicalizer;
private CanonicalizerInterface $canonicalizer;

public function __construct(CanonicalizerInterface $canonicalizer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

final class ChannelDeletionListener
{
/** @var ChannelRepositoryInterface */
private $channelRepository;
private ChannelRepositoryInterface $channelRepository;

public function __construct(ChannelRepositoryInterface $repository)
{
Expand Down
Loading