diff --git a/composer.json b/composer.json index a575e71..8ab0fc3 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php": "^8.0", - "sylius/grid-bundle": "1.11-rc.3", + "sylius/grid-bundle": "^1.11", "sylius/locale-bundle": "^1.11", "sylius/mailer-bundle": "^1.6", "sylius/resource-bundle": "^1.9", diff --git a/src/Command/CommandExecutor.php b/src/Command/CommandExecutor.php index ea5de7b..670fbd9 100644 --- a/src/Command/CommandExecutor.php +++ b/src/Command/CommandExecutor.php @@ -35,11 +35,11 @@ public function runCommand($command, $parameters = [], OutputInterface $output = $this->application->setAutoExit(false); $exitCode = $this->application->run(new ArrayInput($parameters), $output ?: new NullOutput()); - if (1 === $exitCode) { + if ($exitCode === 1) { throw new RuntimeException('This command terminated with a permission error'); } - if (0 !== $exitCode) { + if ($exitCode !== 0) { $this->application->setAutoExit(true); $errorMessage = sprintf('The command terminated with an error code: %u.', $exitCode); diff --git a/src/Command/SetupCommand.php b/src/Command/SetupCommand.php index 976d0b5..352284d 100644 --- a/src/Command/SetupCommand.php +++ b/src/Command/SetupCommand.php @@ -3,6 +3,7 @@ namespace Platform\Bundle\AdminBundle\Command; use Doctrine\ORM\EntityManagerInterface; +use InvalidArgumentException; use Platform\Bundle\AdminBundle\Installer\Setup\LocaleSetup; use Platform\Bundle\AdminBundle\Model\AdminUserInterface; use Sylius\Component\Resource\Factory\FactoryInterface; @@ -77,7 +78,7 @@ private function setupAdministratorUser(InputInterface $input, OutputInterface $ try { $user = $this->configureNewUser($this->userFactory->createNew(), $input, $output); - } catch (\InvalidArgumentException $exception) { + } catch (InvalidArgumentException $exception) { return; } @@ -110,7 +111,7 @@ private function configureNewUser( do { $question = $this->createEmailQuestion($output); $email = $questionHelper->ask($input, $output, $question); - $exists = null !== $this->userRepository->findOneByEmail($email); + $exists = $this->userRepository->findOneByEmail($email) !== null; if ($exists) { $output->writeln('E-Mail is already in use!'); diff --git a/src/Context/AdminBasedLocaleContext.php b/src/Context/AdminBasedLocaleContext.php index 4650dab..5ff94ab 100644 --- a/src/Context/AdminBasedLocaleContext.php +++ b/src/Context/AdminBasedLocaleContext.php @@ -21,12 +21,12 @@ public function __construct(TokenStorageInterface $tokenStorage) public function getLocaleCode(): string { $token = $this->tokenStorage->getToken(); - if (null === $token) { + if ($token === null) { throw new LocaleNotFoundException(); } $adminUser = $token->getUser(); - if (false === $adminUser instanceof AdminUserInterface) { + if (!$adminUser instanceof AdminUserInterface) { throw new LocaleNotFoundException(); } diff --git a/src/DependencyInjection/PlatformAdminExtension.php b/src/DependencyInjection/PlatformAdminExtension.php index 49bf838..9b5340f 100644 --- a/src/DependencyInjection/PlatformAdminExtension.php +++ b/src/DependencyInjection/PlatformAdminExtension.php @@ -5,14 +5,14 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; class PlatformAdminExtension extends Extension { /** {@inheritdoc} */ public function load(array $configs, ContainerBuilder $container): void { - $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.xml'); } diff --git a/src/EventListener/CanonicalizerListener.php b/src/EventListener/CanonicalizerListener.php index 9b5385a..f5a7139 100644 --- a/src/EventListener/CanonicalizerListener.php +++ b/src/EventListener/CanonicalizerListener.php @@ -29,9 +29,11 @@ private function canonicalize(LifecycleEventArgs $event): void { $item = $event->getEntity(); - if ($item instanceof UserInterface) { - $item->setUsernameCanonical($this->canonicalizer->canonicalize($item->getUsername())); - $item->setEmailCanonical($this->canonicalizer->canonicalize($item->getEmail())); + if (!$item instanceof UserInterface) { + return; } + + $item->setUsernameCanonical($this->canonicalizer->canonicalize($item->getUsername())); + $item->setEmailCanonical($this->canonicalizer->canonicalize($item->getEmail())); } } diff --git a/src/Installer/Setup/LocaleSetup.php b/src/Installer/Setup/LocaleSetup.php index 975e5a8..df10646 100644 --- a/src/Installer/Setup/LocaleSetup.php +++ b/src/Installer/Setup/LocaleSetup.php @@ -9,6 +9,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Intl\Languages; +use function trim; +use function sprintf; + class LocaleSetup { private RepositoryInterface $repository; @@ -30,7 +33,7 @@ public function setup(InputInterface $input, OutputInterface $output): LocaleInt $output->writeln(sprintf('Adding %s locale.', $name)); $existingLocale = $this->repository->findOneBy(['code' => $this->locale]); - if (null !== $existingLocale) { + if ($existingLocale !== null) { return $existingLocale; } diff --git a/src/Resources/views/Security/login.html.twig b/src/Resources/views/Security/login.html.twig index f811b07..cdffecb 100644 --- a/src/Resources/views/Security/login.html.twig +++ b/src/Resources/views/Security/login.html.twig @@ -3,7 +3,7 @@ {% block title %}Admin platform | {{ 'sylius.ui.administration_panel_login'|trans }}{% endblock %} {% block stylesheets %} - {% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/admin/css/style.css'} %} + {{ encore_entry_link_tags('app') }} {% endblock %} {% block content %} @@ -11,5 +11,5 @@ {% endblock %} {% block javascripts %} - {% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/admin/js/app.js'} %} + {{ encore_entry_script_tags('app') }} {% endblock %}