diff --git a/psalm.xml b/psalm.xml index 41917b97bf8..1ac493123aa 100644 --- a/psalm.xml +++ b/psalm.xml @@ -88,6 +88,7 @@ + @@ -104,6 +105,7 @@ + @@ -168,6 +170,7 @@ + diff --git a/src/Sylius/Bundle/AdminApiBundle/Command/CreateClientCommand.php b/src/Sylius/Bundle/AdminApiBundle/Command/CreateClientCommand.php index bdb6a45fe70..35c41401db7 100644 --- a/src/Sylius/Bundle/AdminApiBundle/Command/CreateClientCommand.php +++ b/src/Sylius/Bundle/AdminApiBundle/Command/CreateClientCommand.php @@ -65,7 +65,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { if (null === $this->clientManager) { @trigger_error('Fetching services directly from the container is deprecated since Sylius 1.2 and will be removed in 2.0.', \E_USER_DEPRECATED); @@ -85,5 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void $client->getSecret() ) ); + + return 0; } } diff --git a/src/Sylius/Bundle/CoreBundle/Command/CancelUnpaidOrdersCommand.php b/src/Sylius/Bundle/CoreBundle/Command/CancelUnpaidOrdersCommand.php index feafdc1dc5e..511f99a1695 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/CancelUnpaidOrdersCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/CancelUnpaidOrdersCommand.php @@ -17,6 +17,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * @final + */ class CancelUnpaidOrdersCommand extends ContainerAwareCommand { /** @@ -34,7 +37,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output) { $expirationTime = $this->getContainer()->getParameter('sylius_order.order_expiration_period'); @@ -47,5 +50,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void $unpaidCartsStateUpdater->cancel(); $this->getContainer()->get('sylius.manager.order')->flush(); + + return 0; } } diff --git a/src/Sylius/Bundle/CoreBundle/Command/CheckRequirementsCommand.php b/src/Sylius/Bundle/CoreBundle/Command/CheckRequirementsCommand.php index 13f54fec965..ca3dac3108b 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/CheckRequirementsCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/CheckRequirementsCommand.php @@ -37,7 +37,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $fulfilled = $this->getContainer()->get('sylius.installer.checker.sylius_requirements')->check($input, $output); @@ -48,5 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void } $output->writeln('Success! Your system can run Sylius properly.'); + + return 0; } } diff --git a/src/Sylius/Bundle/CoreBundle/Command/InformAboutGUSCommand.php b/src/Sylius/Bundle/CoreBundle/Command/InformAboutGUSCommand.php index 040d0c735fd..0da4cb8e392 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/InformAboutGUSCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/InformAboutGUSCommand.php @@ -26,7 +26,7 @@ protected function configure(): void $this->setDescription('Informs about Sylius internal statistical service'); } - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $style = new SymfonyStyle($input, $output); @@ -44,5 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void 'That being said, every time we get a notification about a new site deployed with Sylius, it brings a huge smile to our face and motivates us to continue our Open Source work.', ] ); + + return 0; } } diff --git a/src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php b/src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php index bebe93ea4dd..195da592cd1 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php @@ -64,7 +64,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $suite = $input->getOption('fixture-suite'); @@ -99,6 +99,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void $outputStyle->newLine(2); $outputStyle->success($this->getProperFinalMessage($errored)); $outputStyle->writeln('You can now open your store at the following path under the website root: /'); + + return $errored ? 1 : 0; } private function getProperFinalMessage(bool $errored): string @@ -112,23 +114,23 @@ private function getProperFinalMessage(bool $errored): string private function getSyliusLogo(): string { - return ' - , - ,;:, - `;;;.:` - `::;` :` - :::` ` .\'++: \'\'. \'. - `::: :+\',;+\' :+; `+. - :::: +\' :\' `+; + return ' + , + ,;:, + `;;;.:` + `::;` :` + :::` ` .\'++: \'\'. \'. + `::: :+\',;+\' :+; `+. + :::: +\' :\' `+; `:::, \'+` ++ :+.`+; `++. ;+\' \'\' ,++++. ,:::` `++\'. .+: `+\' `+; .+, ;+ +\' +; \'\' - ::::` ,+++. \'+` :+. `+; `+, ;+ +\' \'+. - ,. .:::: .++` `+: +\' `+; `+, ;+ +\' `;++; + ::::` ,+++. \'+` :+. `+; `+, ;+ +\' \'+. + ,. .:::: .++` `+: +\' `+; `+, ;+ +\' `;++; `;;.:::` ::::: :+. \'+,+. `+; `+, ;+ `+\' .++ .;;;;;;::`.::::, +\'` `++ `++\' `+; `+: :+. `++\' \'. ;+ ,;;;;;;;;;::::: .+++++` ;+, ++; ++, `\'+++,\'+\' :++++, - ,;;;;;;;;;:::` ;\' - :;;;;;;;;;:, :.:+, + ,;;;;;;;;;:::` ;\' + :;;;;;;;;;:, :.:+, ;;;;;;;;;: ;++,' ; } diff --git a/src/Sylius/Bundle/CoreBundle/Command/InstallDatabaseCommand.php b/src/Sylius/Bundle/CoreBundle/Command/InstallDatabaseCommand.php index 0dc52b03e8f..aa0da67f748 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/InstallDatabaseCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/InstallDatabaseCommand.php @@ -39,7 +39,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $suite = $input->getOption('fixture-suite'); @@ -63,5 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void $parameters['--fixture-suite'] = $suite; } $this->commandExecutor->runCommand('sylius:install:sample-data', $parameters, $output); + + return 0; } } diff --git a/src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php b/src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php index 30ecb105d21..6a9c32cc7fc 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php @@ -45,12 +45,14 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $currency = $this->getContainer()->get('sylius.setup.currency')->setup($input, $output, $this->getHelper('question')); $locale = $this->getContainer()->get('sylius.setup.locale')->setup($input, $output, $this->getHelper('question')); $this->getContainer()->get('sylius.setup.channel')->setup($locale, $currency); $this->setupAdministratorUser($input, $output, $locale->getCode()); + + return 0; } protected function setupAdministratorUser(InputInterface $input, OutputInterface $output, string $localeCode): void diff --git a/src/Sylius/Bundle/CoreBundle/Command/ShowAvailablePluginsCommand.php b/src/Sylius/Bundle/CoreBundle/Command/ShowAvailablePluginsCommand.php index 4a99f080332..58b39910585 100644 --- a/src/Sylius/Bundle/CoreBundle/Command/ShowAvailablePluginsCommand.php +++ b/src/Sylius/Bundle/CoreBundle/Command/ShowAvailablePluginsCommand.php @@ -36,7 +36,7 @@ protected function configure(): void $this->configurePlugins(); } - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Available official Sylius Plugins:'); @@ -48,6 +48,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void } $pluginTable->render(); + + return 0; } private function configurePlugins(): void diff --git a/src/Sylius/Bundle/OrderBundle/Command/RemoveExpiredCartsCommand.php b/src/Sylius/Bundle/OrderBundle/Command/RemoveExpiredCartsCommand.php index 8f34ae39cfa..ba5e2fcebda 100644 --- a/src/Sylius/Bundle/OrderBundle/Command/RemoveExpiredCartsCommand.php +++ b/src/Sylius/Bundle/OrderBundle/Command/RemoveExpiredCartsCommand.php @@ -17,6 +17,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +/** + * @final + */ class RemoveExpiredCartsCommand extends ContainerAwareCommand { /** @@ -33,7 +36,7 @@ protected function configure(): void /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output) { $expirationTime = $this->getContainer()->getParameter('sylius_order.cart_expiration_period'); $output->writeln( @@ -42,5 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void $expiredCartsRemover = $this->getContainer()->get('sylius.expired_carts_remover'); $expiredCartsRemover->remove(); + + return 0; } } diff --git a/src/Sylius/Bundle/ShopBundle/EventListener/SessionCartSubscriber.php b/src/Sylius/Bundle/ShopBundle/EventListener/SessionCartSubscriber.php index dfc466cd8c9..1c23ebd4755 100644 --- a/src/Sylius/Bundle/ShopBundle/EventListener/SessionCartSubscriber.php +++ b/src/Sylius/Bundle/ShopBundle/EventListener/SessionCartSubscriber.php @@ -52,8 +52,9 @@ public function onKernelResponse(ResponseEvent $event): void return; } - $session = $event->getRequest()->getSession(); - if ($session && !$session->isStarted()) { + $request = $event->getRequest(); + + if (!$request->hasSession() || !$request->getSession()->isStarted()) { return; } diff --git a/src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php b/src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php index 93cd1e02b02..b6954fc2479 100644 --- a/src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php +++ b/src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php @@ -80,7 +80,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output) { $email = $input->getArgument('email'); $securityRoles = $input->getArgument('roles'); @@ -95,6 +95,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void $user = $this->findUserByEmail($email, $userType); $this->executeRoleCommand($input, $output, $user, $securityRoles); + + return 0; } /** diff --git a/src/Sylius/Component/User/Model/User.php b/src/Sylius/Component/User/Model/User.php index dfd9ecdd774..161e3920646 100644 --- a/src/Sylius/Component/User/Model/User.php +++ b/src/Sylius/Component/User/Model/User.php @@ -96,7 +96,7 @@ class User implements UserInterface protected $roles = [UserInterface::DEFAULT_ROLE]; /** - * @var Collection */ + * @var Collection */ protected $oauthAccounts; /** @var string|null */