Skip to content

Commit

Permalink
PHP 7.4 syntax in bundles vol.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Aug 31, 2021
1 parent 39da740 commit fed2953
Show file tree
Hide file tree
Showing 190 changed files with 360 additions and 625 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@
"mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.4",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.82",
"phpstan/phpstan": "0.12.96",
"phpstan/phpstan-doctrine": "0.12.33",
"phpunit/phpunit": "^8.5",
"psalm/plugin-mockery": "0.7.0",
"psr/event-dispatcher": "^1.0",
"rector/rector": "^0.11.52",
"stripe/stripe-php": "^6.43",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
Expand Down
18 changes: 18 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void
{
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);

$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
*/
final class BuildAddressFormSubscriber implements EventSubscriberInterface
{
/** @var ObjectRepository */
private $countryRepository;
private ObjectRepository $countryRepository;

/** @var FormFactoryInterface */
private $formFactory;
private FormFactoryInterface $formFactory;

public function __construct(ObjectRepository $countryRepository, FormFactoryInterface $factory)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Sylius/Bundle/AddressingBundle/Form/Type/AddressType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class AddressType extends AbstractResourceType
{
/** @var EventSubscriberInterface */
private $buildAddressFormSubscriber;
private EventSubscriberInterface $buildAddressFormSubscriber;

/**
* @param string[] $validationGroups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

final class CountryChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $countryRepository;
private RepositoryInterface $countryRepository;

public function __construct(RepositoryInterface $countryRepository)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

final class CountryCodeChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $countryRepository;
private RepositoryInterface $countryRepository;

public function __construct(RepositoryInterface $countryRepository)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class ProvinceChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $provinceRepository;
private RepositoryInterface $provinceRepository;

public function __construct(RepositoryInterface $provinceRepository)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

final class ProvinceCodeChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $provinceRepository;
private RepositoryInterface $provinceRepository;

public function __construct(RepositoryInterface $provinceRepository)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@

final class ZoneChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $zoneRepository;
private RepositoryInterface $zoneRepository;

/** @var string[] */
private $scopeTypes;
private array $scopeTypes;

public function __construct(RepositoryInterface $zoneRepository, array $scopeTypes = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

final class ZoneCodeChoiceType extends AbstractType
{
/** @var RepositoryInterface */
private $zoneRepository;
private RepositoryInterface $zoneRepository;

public function __construct(RepositoryInterface $zoneRepository)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Sylius/Bundle/AddressingBundle/Form/Type/ZoneType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

final class ZoneType extends AbstractResourceType
{
/** @var array */
private $scopeChoices;
private array $scopeChoices;

/**
* @param string[] $validationGroups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\AddressingBundle\Tests\Form\Type;

use Prophecy\Prophecy\ObjectProphecy;
use PHPUnit\Framework\Assert;
use Prophecy\Prophecy\ProphecyInterface;
use Sylius\Bundle\AddressingBundle\Form\Type\CountryChoiceType;
Expand All @@ -24,8 +25,7 @@

final class CountryChoiceTypeTest extends TypeTestCase
{
/** @var ProphecyInterface|RepositoryInterface */
private $countryRepository;
private ObjectProphecy $countryRepository;

/** @var ProphecyInterface|CountryInterface */
private $france;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Sylius\Bundle\AddressingBundle\Tests\Form\Type;

use Prophecy\Prophecy\ObjectProphecy;
use PHPUnit\Framework\Assert;
use Prophecy\Prophecy\ProphecyInterface;
use Sylius\Bundle\AddressingBundle\Form\Type\ZoneChoiceType;
Expand All @@ -25,8 +26,7 @@

final class ZoneChoiceTypeTest extends TypeTestCase
{
/** @var ProphecyInterface|RepositoryInterface */
private $zoneRepository;
private ObjectProphecy $zoneRepository;

/** @var ProphecyInterface|ZoneInterface */
private $zoneAllScopes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

class ProvinceNamingExtension extends AbstractExtension
{
/** @var ProvinceNamingProviderInterface */
private $provinceNamingProvider;
private ProvinceNamingProviderInterface $provinceNamingProvider;

public function __construct(ProvinceNamingProviderInterface $provinceNamingProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
*/
class ProvinceAddressConstraint extends Constraint
{
/** @var string */
public $message = 'sylius.address.province.valid';
public string $message = 'sylius.address.province.valid';

public function getTargets(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@

class ProvinceAddressConstraintValidator extends ConstraintValidator
{
/** @var RepositoryInterface */
private $countryRepository;
private RepositoryInterface $countryRepository;

/** @var RepositoryInterface */
private $provinceRepository;
private RepositoryInterface $provinceRepository;

public function __construct(RepositoryInterface $countryRepository, RepositoryInterface $provinceRepository)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

final class ZoneCannotContainItself extends Constraint
{
/** @var string */
public $message = 'sylius.zone_member.cannot_be_the_same_as_zone';
public string $message = 'sylius.zone_member.cannot_be_the_same_as_zone';

public function validatedBy(): string
{
Expand Down
9 changes: 3 additions & 6 deletions src/Sylius/Bundle/AdminBundle/Action/RemoveAvatarAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@

final class RemoveAvatarAction
{
/** @var AvatarImageRepositoryInterface */
private $avatarRepository;
private AvatarImageRepositoryInterface $avatarRepository;

/** @var RouterInterface */
private $router;
private RouterInterface $router;

/** @var CsrfTokenManagerInterface */
private $csrfTokenManager;
private CsrfTokenManagerInterface $csrfTokenManager;

public function __construct(
AvatarImageRepositoryInterface $avatarRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,26 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;

final class ResendOrderConfirmationEmailAction
{
/** @var OrderRepositoryInterface */
private $orderRepository;
private OrderRepositoryInterface $orderRepository;

/** @var OrderEmailManagerInterface */
private $orderEmailManager;
private OrderEmailManagerInterface $orderEmailManager;

/** @var CsrfTokenManagerInterface */
private $csrfTokenManager;
private CsrfTokenManagerInterface $csrfTokenManager;

/** @var Session */
private $session;
private Session $session;

public function __construct(
OrderRepositoryInterface $orderRepository,
OrderEmailManagerInterface $orderEmailManager,
CsrfTokenManagerInterface $csrfTokenManager,
SessionInterface $session
Session $session
) {
$this->orderRepository = $orderRepository;
$this->orderEmailManager = $orderEmailManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,26 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;

final class ResendShipmentConfirmationEmailAction
{
/** @var ShipmentRepositoryInterface */
private $shipmentRepository;
private ShipmentRepositoryInterface $shipmentRepository;

/** @var ShipmentEmailManagerInterface */
private $shipmentEmailManager;
private ShipmentEmailManagerInterface $shipmentEmailManager;

/** @var CsrfTokenManagerInterface */
private $csrfTokenManager;
private CsrfTokenManagerInterface $csrfTokenManager;

/** @var Session */
private $session;
private Session $session;

public function __construct(
ShipmentRepositoryInterface $shipmentRepository,
ShipmentEmailManagerInterface $shipmentEmailManager,
CsrfTokenManagerInterface $csrfTokenManager,
SessionInterface $session
Session $session
) {
$this->shipmentRepository = $shipmentRepository;
$this->shipmentEmailManager = $shipmentEmailManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

final class AdminBasedLocaleContext implements LocaleContextInterface
{
/** @var TokenStorageInterface */
private $tokenStorage;
private TokenStorageInterface $tokenStorage;

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

final class CustomerStatisticsController
{
/** @var CustomerStatisticsProviderInterface */
private $statisticsProvider;
private CustomerStatisticsProviderInterface $statisticsProvider;

/** @var RepositoryInterface */
private $customerRepository;
private RepositoryInterface $customerRepository;

/** @var EngineInterface|Environment */
private $templatingEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ final class StatisticsController
/** @var EngineInterface|Environment */
private $templatingEngine;

/** @var StatisticsDataProviderInterface */
private $statisticsDataProvider;
private StatisticsDataProviderInterface $statisticsDataProvider;

/**
* @param EngineInterface|Environment $templatingEngine
Expand Down
12 changes: 4 additions & 8 deletions src/Sylius/Bundle/AdminBundle/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,16 @@

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

/** @var EngineInterface|Environment */
private $templatingEngine;

/** @var RouterInterface */
private $router;
private RouterInterface $router;

/** @var SalesDataProviderInterface|null */
private $salesDataProvider;
private ?SalesDataProviderInterface $salesDataProvider;

/** @var StatisticsDataProviderInterface */
private $statisticsDataProvider;
private ?StatisticsDataProviderInterface $statisticsDataProvider;

/**
* @param EngineInterface|Environment $templatingEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,15 @@

final class ImpersonateUserController
{
/** @var UserImpersonatorInterface */
private $impersonator;
private UserImpersonatorInterface $impersonator;

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

/** @var UserProviderInterface */
private $userProvider;
private UserProviderInterface $userProvider;

/** @var RouterInterface|null */
private $router;
private ?RouterInterface $router;

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

public function __construct(
UserImpersonatorInterface $impersonator,
Expand Down

0 comments on commit fed2953

Please sign in to comment.