Skip to content

Commit

Permalink
Update to the latest versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrejus Voitovas committed Apr 8, 2022
1 parent 8ecb4c7 commit 690d42c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/Command/AbstractInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ abstract class AbstractInstallCommand extends Command
protected function initialize(InputInterface $input, OutputInterface $output): void
{
$application = $this->getApplication();

if ($application === null) {
return;
}

$application->setCatchExceptions(false);

$this->commandExecutor = new CommandExecutor(
Expand Down
17 changes: 9 additions & 8 deletions src/Command/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use Platform\Bundle\AdminBundle\Model\AdminUserInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\User\Repository\UserRepositoryInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Webmozart\Assert\Assert;

Expand Down Expand Up @@ -61,11 +61,13 @@ protected function configure(): void
);
}

protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$locale = $this->localeSetup->setup($input, $output);

$this->setupAdministratorUser($input, $output, $locale->getCode());

return Command::SUCCESS;
}

private function setupAdministratorUser(InputInterface $input, OutputInterface $output, ?string $localeCode): void
Expand Down Expand Up @@ -137,11 +139,11 @@ function ($value) use ($output) {
->setMaxAttempts(3);
}

private function getAdministratorPassword(InputInterface $input, OutputInterface $output)
private function getAdministratorPassword(InputInterface $input, OutputInterface $output): string
{
/** @var QuestionHelper $questionHelper */
$questionHelper = $this->getHelper('question');
$validator = $this->getPasswordQuestionValidator($output);
$validator = $this->getPasswordQuestionValidator();

do {
$passwordQuestion = $this->createPasswordQuestion('Choose password:', $validator);
Expand All @@ -157,10 +159,9 @@ private function getAdministratorPassword(InputInterface $input, OutputInterface
return $password;
}

private function getPasswordQuestionValidator(OutputInterface $output)
private function getPasswordQuestionValidator()
{
return function ($value) use ($output) {
/** @var ConstraintViolationListInterface $errors */
return function ($value) {
$errors = $this->validator->validate($value, [new NotBlank()]);
foreach ($errors as $error) {
throw new \DomainException($error->getMessage());
Expand All @@ -170,7 +171,7 @@ private function getPasswordQuestionValidator(OutputInterface $output)
};
}

private function createPasswordQuestion($message, \Closure $validator): Question
private function createPasswordQuestion(string $message, \Closure $validator): Question
{
return (new Question($message))
->setValidator($validator)
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/PlatformAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class PlatformAdminExtension extends Extension
{
/** {@inheritdoc} */
public function load(array $config, ContainerBuilder $container): void
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/routing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/routing https://symfony.com/schema/routing/routing-1.0.xsd">

<import resource="routing/admin_user.yml" />
<import resource="routing/dashboard.yml" />
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">

<imports>
<import resource="services/commands.xml" />
Expand Down

0 comments on commit 690d42c

Please sign in to comment.