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

Use php 7.4 syntax #384

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@
"phpstan/phpstan-phpunit": "0.12.18",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sylius-labs/coding-standard": "^3.0",
"sylius-labs/coding-standard": "^4.0",
"sylius/grid-bundle": "^1.7",
"symfony/dependency-injection": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symplify/easy-coding-standard": "^8.3",
"symplify/easy-coding-standard": "^9.4",
"twig/twig": "^2.12 || ^3.0",
"vimeo/psalm": "4.7.0"
"vimeo/psalm": "4.7.0",
"rector/rector": "^0.11.47"
},
"suggest": {
"doctrine/orm": "^2.5",
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<referencedMethod name="Symfony\Component\EventDispatcher\Event::isPropagationStopped" />
<referencedMethod name="Symfony\Component\EventDispatcher\Event::stopPropagation" />
</errorLevel>
<errorLevel type="info">
<referencedMethod name="Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest" />
</errorLevel>
</DeprecatedMethod>

<InvalidDocblock>
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);
};
4 changes: 1 addition & 3 deletions src/Bundle/AbstractResourceBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ abstract class AbstractResourceBundle extends Bundle implements ResourceBundleIn
{
/**
* Configure format of mapping files.
*
* @var string
*/
protected $mappingFormat = ResourceBundleInterface::MAPPING_XML;
protected string $mappingFormat = ResourceBundleInterface::MAPPING_XML;

public function build(ContainerBuilder $container): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Command/DebugResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

final class DebugResourceCommand extends Command
{
/** @var RegistryInterface */
private $registry;
private RegistryInterface $registry;

public function __construct(RegistryInterface $registry)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

final class EventDispatcher implements EventDispatcherInterface
{
/** @var SymfonyEventDispatcherInterface */
private $eventDispatcher;
private SymfonyEventDispatcherInterface $eventDispatcher;

public function __construct(SymfonyEventDispatcherInterface $eventDispatcher)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Bundle/Controller/FlashHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@

final class FlashHelper implements FlashHelperInterface
{
/** @var SessionInterface */
private $session;
private SessionInterface $session;

/** @var TranslatorInterface */
private $translator;
private TranslatorInterface $translator;

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

public function __construct(SessionInterface $session, TranslatorInterface $translator, string $defaultLocale)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Controller/ParametersParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

final class ParametersParser implements ParametersParserInterface
{
/** @var ContainerInterface */
private $container;
private ContainerInterface $container;

/** @var ExpressionLanguage */
private $expression;
private ExpressionLanguage $expression;

public function __construct(ContainerInterface $container, ExpressionLanguage $expression)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/RedirectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class RedirectHandler implements RedirectHandlerInterface
{
/** @var RouterInterface */
private $router;
private RouterInterface $router;

public function __construct(RouterInterface $router)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Bundle/Controller/RequestConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@

class RequestConfiguration
{
/** @var Request */
private $request;
private Request $request;

/** @var MetadataInterface */
private $metadata;
private MetadataInterface $metadata;

/** @var Parameters */
private $parameters;
private Parameters $parameters;

public function __construct(MetadataInterface $metadata, Request $request, Parameters $parameters)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Controller/RequestConfigurationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class RequestConfigurationFactory implements RequestConfigurationFactoryIn

private const API_GROUPS_REGEXP = '/(g|groups)=(?P<groups>[a-z,_\s]+)/i';

/** @var ParametersParserInterface */
private $parametersParser;
private ParametersParserInterface $parametersParser;

/**
* @var string
Expand All @@ -36,8 +35,7 @@ final class RequestConfigurationFactory implements RequestConfigurationFactoryIn
*/
private $configurationClass;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not this one ?


/** @var array */
private $defaultParameters;
private array $defaultParameters;

/**
* @psalm-param class-string<RequestConfiguration> $configurationClass
Expand Down
51 changes: 17 additions & 34 deletions src/Bundle/Controller/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,39 @@ class ResourceController
use ControllerTrait;
use ContainerAwareTrait;

/** @var MetadataInterface */
protected $metadata;
protected MetadataInterface $metadata;

/** @var RequestConfigurationFactoryInterface */
protected $requestConfigurationFactory;
protected RequestConfigurationFactoryInterface $requestConfigurationFactory;

/** @var ViewHandlerInterface|null */
protected $viewHandler;
protected ?ViewHandlerInterface $viewHandler;

/** @var RepositoryInterface */
protected $repository;
protected RepositoryInterface $repository;

/** @var FactoryInterface */
protected $factory;
protected FactoryInterface $factory;

/** @var NewResourceFactoryInterface */
protected $newResourceFactory;
protected NewResourceFactoryInterface $newResourceFactory;

/** @var ObjectManager */
protected $manager;
protected ObjectManager $manager;

/** @var SingleResourceProviderInterface */
protected $singleResourceProvider;
protected SingleResourceProviderInterface $singleResourceProvider;

/** @var ResourcesCollectionProviderInterface */
protected $resourcesCollectionProvider;
protected ResourcesCollectionProviderInterface $resourcesCollectionProvider;

/** @var ResourceFormFactoryInterface */
protected $resourceFormFactory;
protected ResourceFormFactoryInterface $resourceFormFactory;

/** @var RedirectHandlerInterface */
protected $redirectHandler;
protected RedirectHandlerInterface $redirectHandler;

/** @var FlashHelperInterface */
protected $flashHelper;
protected FlashHelperInterface $flashHelper;

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

/** @var EventDispatcherInterface */
protected $eventDispatcher;
protected EventDispatcherInterface $eventDispatcher;

/** @var StateMachineInterface|null */
protected $stateMachine;
protected ?StateMachineInterface $stateMachine;

/** @var ResourceUpdateHandlerInterface */
protected $resourceUpdateHandler;
protected ResourceUpdateHandlerInterface $resourceUpdateHandler;

/** @var ResourceDeleteHandlerInterface */
protected $resourceDeleteHandler;
protected ResourceDeleteHandlerInterface $resourceDeleteHandler;

public function __construct(
MetadataInterface $metadata,
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/ResourceFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

final class ResourceFormFactory implements ResourceFormFactoryInterface
{
/** @var FormFactoryInterface */
private $formFactory;
private FormFactoryInterface $formFactory;

public function __construct(FormFactoryInterface $formFactory)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/ResourceUpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

final class ResourceUpdateHandler implements ResourceUpdateHandlerInterface
{
/** @var StateMachineInterface|null */
private $stateMachine;
private ?StateMachineInterface $stateMachine;

public function __construct(?StateMachineInterface $stateMachine)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Controller/ResourcesCollectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

final class ResourcesCollectionProvider implements ResourcesCollectionProviderInterface
{
/** @var ResourcesResolverInterface */
private $resourcesResolver;
private ResourcesResolverInterface $resourcesResolver;

/** @var PagerfantaFactory */
private $pagerfantaRepresentationFactory;
private PagerfantaFactory $pagerfantaRepresentationFactory;

public function __construct(ResourcesResolverInterface $resourcesResolver, PagerfantaFactory $pagerfantaRepresentationFactory)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/StateMachine.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

final class StateMachine implements StateMachineInterface
{
/** @var FactoryInterface */
private $stateMachineFactory;
private FactoryInterface $stateMachineFactory;

public function __construct(FactoryInterface $stateMachineFactory)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Controller/ViewHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

final class ViewHandler implements ViewHandlerInterface
{
/** @var ConfigurableViewHandlerInterface */
private $restViewHandler;
private ConfigurableViewHandlerInterface $restViewHandler;

public function __construct(ConfigurableViewHandlerInterface $restViewHandler)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
*/
final class DoctrineTargetEntitiesResolverPass implements CompilerPassInterface
{
/** @var TargetEntitiesResolverInterface */
private $targetEntitiesResolver;
private TargetEntitiesResolverInterface $targetEntitiesResolver;

public function __construct(TargetEntitiesResolverInterface $targetEntitiesResolver)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@

abstract class PrioritizedCompositeServicePass implements CompilerPassInterface
{
/** @var string */
private $serviceId;
private string $serviceId;

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

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

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

public function __construct(string $serviceId, string $compositeId, string $tagName, string $methodName)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/DependencyInjection/Driver/DriverProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
final class DriverProvider
{
/** @var DriverInterface[] */
private static $drivers = [];
private static array $drivers = [];

/**
* @throws UnknownDriverException
Expand Down
Loading