Skip to content

Commit

Permalink
Use PHP 7.4 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Oct 11, 2021
1 parent 8e0f789 commit 02cfbad
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 92 deletions.
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);
};
16 changes: 2 additions & 14 deletions src/EventListener/AdminListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@

final class AdminListener
{
/**
* @var Session
*/
private $session;

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

public function __construct(Session $session)
{
$this->session = $session;
}

/**
* @param GenericEvent $event
*/
public function preDelete(GenericEvent $event): void
{
$subject = $subject = $event->getSubject();
Expand All @@ -39,9 +30,6 @@ public function preDelete(GenericEvent $event): void
}
}

/**
* @param GenericEvent $event
*/
public function preUpdate(GenericEvent $event): void
{
$subject = $subject = $event->getSubject();
Expand Down
20 changes: 4 additions & 16 deletions src/EventListener/ChannelListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,16 @@

final class ChannelListener
{
/**
* @var Session
*/
private $session;

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

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

private Router $router;

public function __construct(Session $session, Router $router)
{
$this->session = $session;
$this->router = $router;
}

/**
* @param GetResponseEvent $event
*/
public function preCreate(GetResponseEvent $event): void
{
if ('sylius_admin_channel_create' === $event->getRequest()->get('_route')) {
Expand Down
21 changes: 4 additions & 17 deletions src/EventListener/UserRegistrationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,10 @@

final class UserRegistrationListener
{
/**
* @var Session
*/
private $session;

/**
* @var FlashMessageGeneratorInterface
*/
private $flashMessageGenerator;

/**
* @param Session $session
* @param FlashMessageGeneratorInterface $flashMessageGenerator
*/
private Session $session;

private FlashMessageGeneratorInterface $flashMessageGenerator;

public function __construct(
Session $session,
FlashMessageGeneratorInterface $flashMessageGenerator
Expand All @@ -41,9 +31,6 @@ public function __construct(
$this->flashMessageGenerator = $flashMessageGenerator;
}

/**
* @param GenericEvent $event
*/
public function addVerificationLink(GenericEvent $event): void
{
/** @var UserInterface $subject */
Expand Down
5 changes: 0 additions & 5 deletions src/Generator/FlashMessageGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,5 @@

interface FlashMessageGeneratorInterface
{
/**
* @param string $token
*
* @return string
*/
public function generate(string $token): string;
}
21 changes: 4 additions & 17 deletions src/Generator/VerificationFlashMessageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,10 @@

final class VerificationFlashMessageGenerator implements FlashMessageGeneratorInterface
{
/**
* @var UrlGeneratorInterface
*/
private $urlGenerator;

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

/**
* @param UrlGeneratorInterface $urlGenerator
* @param TranslatorInterface $translator
*/
private UrlGeneratorInterface $urlGenerator;

private TranslatorInterface $translator;

public function __construct(
UrlGeneratorInterface $urlGenerator,
TranslatorInterface $translator
Expand All @@ -38,9 +28,6 @@ public function __construct(
$this->translator = $translator;
}

/**
* {@inheritdoc}
*/
public function generate(string $token): string
{
$url = $this
Expand Down
15 changes: 6 additions & 9 deletions tests/Behat/Context/Ui/Admin/ManagingAdministratorsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@

final class ManagingAdministratorsContext implements Context
{
/** @var NotificationCheckerInterface */
private $notificationChecker;
private ?NotificationCheckerInterface $notificationChecker;

/** @var RepositoryInterface */
private $adminUserRepository;
private ?RepositoryInterface $adminUserRepository;

/** @var UpdatePageInterface */
private $adminUserUpdatePage;
private ?UpdatePageInterface $adminUserUpdatePage;

public function __construct(
NotificationCheckerInterface $notificationChecker,
RepositoryInterface $adminUserRepository,
UpdatePageInterface $adminUserUpdatePage
?NotificationCheckerInterface $notificationChecker,
?RepositoryInterface $adminUserRepository,
?UpdatePageInterface $adminUserUpdatePage
) {
$this->notificationChecker = $notificationChecker;
$this->adminUserRepository = $adminUserRepository;
Expand Down
8 changes: 3 additions & 5 deletions tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

final class ManagingChannelsContext implements Context
{
/** @var CreatePageInterface */
private $channelCreatePage;
private ?CreatePageInterface $channelCreatePage;

/** @var NotificationCheckerInterface */
private $notificationChecker;
private ?NotificationCheckerInterface $notificationChecker;

public function __construct(CreatePageInterface $channelCreatePage, NotificationCheckerInterface $notificationChecker)
public function __construct(?CreatePageInterface $channelCreatePage, ?NotificationCheckerInterface $notificationChecker)
{
$this->channelCreatePage = $channelCreatePage;
$this->notificationChecker = $notificationChecker;
Expand Down
15 changes: 6 additions & 9 deletions tests/Behat/Context/Ui/Shop/RegistrationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@

final class RegistrationContext implements Context
{
/** @var NotificationCheckerInterface */
private $notificationChecker;
private ?NotificationCheckerInterface $notificationChecker;

/** @var UrlGeneratorInterface */
private $urlGenerator;
private ?UrlGeneratorInterface $urlGenerator;

/** @var RepositoryInterface */
private $shopUserRepository;
private ?RepositoryInterface $shopUserRepository;

public function __construct(
NotificationCheckerInterface $notificationChecker,
UrlGeneratorInterface $urlGenerator,
RepositoryInterface $shopUserRepository
?NotificationCheckerInterface $notificationChecker,
?UrlGeneratorInterface $urlGenerator,
?RepositoryInterface $shopUserRepository
) {
$this->notificationChecker = $notificationChecker;
$this->urlGenerator = $urlGenerator;
Expand Down

0 comments on commit 02cfbad

Please sign in to comment.