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

[Psalm] Fix the build after Symfony 4.4 update #10873

Merged
merged 1 commit into from Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions psalm.xml
Expand Up @@ -88,6 +88,7 @@
<referencedClass name="Symfony\Component\Intl\ResourceBundle\RegionBundleInterface" />
<referencedClass name="Symfony\Component\Security\Core\Role\Role" />
<referencedClass name="Symfony\Component\Translation\TranslatorInterface" />
<referencedClass name="Symfony\Bundle\WebServerBundle\WebServerBundle" />
</errorLevel>
</DeprecatedClass>
<DeprecatedInterface>
Expand All @@ -104,6 +105,7 @@
<referencedMethod name="Symfony\Component\Intl\Intl::getLanguageBundle" />
<referencedMethod name="Symfony\Component\Intl\Intl::getLocaleBundle" />
<referencedMethod name="Symfony\Component\Intl\Intl::getRegionBundle" />
<referencedMethod name="Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent::getException" />
</errorLevel>
</DeprecatedMethod>

Expand Down Expand Up @@ -168,6 +170,7 @@
<TooManyArguments>
<errorLevel type="info">
<referencedFunction name="Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch" />
<referencedFunction name="Symfony\Component\HttpKernel\Config\FileLocator::__construct" />
</errorLevel>
<errorLevel type="suppress">
<referencedFunction name="Doctrine\ORM\Query\Expr::andX" />
Expand Down
Expand Up @@ -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);
Expand All @@ -85,5 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
$client->getSecret()
)
);

return 0;
}
}
Expand Up @@ -17,6 +17,9 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @final
*/
class CancelUnpaidOrdersCommand extends ContainerAwareCommand
{
/**
Expand All @@ -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');

Expand All @@ -47,5 +50,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
$unpaidCartsStateUpdater->cancel();

$this->getContainer()->get('sylius.manager.order')->flush();

return 0;
}
}
Expand Up @@ -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);

Expand All @@ -48,5 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
}

$output->writeln('<info>Success! Your system can run Sylius properly.</info>');

return 0;
}
}
Expand Up @@ -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);

Expand All @@ -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;
}
}
28 changes: 15 additions & 13 deletions src/Sylius/Bundle/CoreBundle/Command/InstallCommand.php
Expand Up @@ -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');

Expand Down Expand Up @@ -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
Expand All @@ -112,23 +114,23 @@ private function getProperFinalMessage(bool $errored): string

private function getSyliusLogo(): string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked, it renders correctly :)

{
return '
<info>,</info>
<info>,;:,</info>
<info>`;;;.:`</info>
<info>`::;` :`</info>
<info>:::` `</info> .\'++: \'\'. \'.
<info>`:::</info> :+\',;+\' :+; `+.
<info>::::</info> +\' :\' `+;
return '
<info>,</info>
<info>,;:,</info>
<info>`;;;.:`</info>
<info>`::;` :`</info>
<info>:::` `</info> .\'++: \'\'. \'.
<info>`:::</info> :+\',;+\' :+; `+.
<info>::::</info> +\' :\' `+;
<info>`:::,</info> \'+` ++ :+.`+; `++. ;+\' \'\' ,++++.
<info>,:::`</info> `++\'. .+: `+\' `+; .+, ;+ +\' +; \'\'
<info>::::`</info> ,+++. \'+` :+. `+; `+, ;+ +\' \'+.
<info>,. .::::</info> .++` `+: +\' `+; `+, ;+ +\' `;++;
<info>::::`</info> ,+++. \'+` :+. `+; `+, ;+ +\' \'+.
<info>,. .::::</info> .++` `+: +\' `+; `+, ;+ +\' `;++;
<info>`;;.:::` :::::</info> :+. \'+,+. `+; `+, ;+ `+\' .++
<info>.;;;;;;::`.::::,</info> +\'` `++ `++\' `+; `+: :+. `++\' \'. ;+
<info>,;;;;;;;;;:::::</info> .+++++` ;+, ++; ++, `\'+++,\'+\' :++++,
<info>,;;;;;;;;;:::</info>` ;\'
<info>:;;;;;;;;;:,</info> :.:+,
<info>,;;;;;;;;;:::</info>` ;\'
<info>:;;;;;;;;;:,</info> :.:+,
<info>;;;;;;;;;:</info> ;++,'
;
}
Expand Down
Expand Up @@ -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');

Expand All @@ -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;
}
}
4 changes: 3 additions & 1 deletion src/Sylius/Bundle/CoreBundle/Command/SetupCommand.php
Expand Up @@ -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
Expand Down
Expand Up @@ -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('<comment>Available official Sylius Plugins:</comment>');

Expand All @@ -48,6 +48,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void
}

$pluginTable->render();

return 0;
}

private function configurePlugins(): void
Expand Down
Expand Up @@ -17,6 +17,9 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @final
*/
class RemoveExpiredCartsCommand extends ContainerAwareCommand
{
/**
Expand All @@ -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(
Expand All @@ -42,5 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void

$expiredCartsRemover = $this->getContainer()->get('sylius.expired_carts_remover');
$expiredCartsRemover->remove();

return 0;
}
}
Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php
Expand Up @@ -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');
Expand All @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Component/User/Model/User.php
Expand Up @@ -96,7 +96,7 @@ class User implements UserInterface
protected $roles = [UserInterface::DEFAULT_ROLE];

/**
* @var Collection<int, UserOAuthInterface> */
* @var Collection<array-key, UserOAuthInterface> */
protected $oauthAccounts;

/** @var string|null */
Expand Down