Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/Command/BaseGenerateBundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

use Pimcore\Bundle\BundleGeneratorBundle\Generator\BundleGenerator;
use Pimcore\Bundle\BundleGeneratorBundle\Model\Bundle;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -29,16 +31,18 @@
*
* The following class is copied from \Sensio\Bundle\BundleGeneratorBundle\Command\GenerateBundleCommand
*/
#[AsCommand(
name: 'generate:bundle',
description: 'Generates a bundle',
)]
class BaseGenerateBundleCommand extends BaseGeneratorCommand
{
/**
* @see Command
*/
protected function configure()
protected function configure(): void
{
$this
->setName('generate:bundle')
->setDescription('Generates a bundle')
->setDefinition([
new InputOption('namespace', '', InputOption::VALUE_REQUIRED, 'The namespace of the bundle to create'),
new InputOption('dir', '', InputOption::VALUE_REQUIRED, 'The directory where to create the bundle', 'bundles/'),
Expand Down Expand Up @@ -77,7 +81,7 @@ protected function configure()
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$questionHelper = $this->getQuestionHelper();

Expand Down Expand Up @@ -112,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$questionHelper->writeGeneratorSummary($output, $errors);

return 0;
return Command::SUCCESS;
}

protected function interact(InputInterface $input, OutputInterface $output)
Expand Down
16 changes: 10 additions & 6 deletions src/Command/GenerateBundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,25 @@

use Pimcore\Bundle\BundleGeneratorBundle\Generator\BundleGenerator;
use Pimcore\Bundle\BundleGeneratorBundle\Model\Bundle;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'pimcore:generate:bundle',
description: 'Generates a Pimcore bundle',
)]
class GenerateBundleCommand extends BaseGenerateBundleCommand
{
/**
* @inheritDoc
*/
protected function configure()
protected function configure(): void
{
parent::configure();

$this
->setName('pimcore:generate:bundle')
->setDescription('Generates a Pimcore bundle')
->setHelp(
<<<EOT
The <info>%command.name%</info> command helps you generates new Pimcore bundles. If you need to create a normal Symfony
Expand Down Expand Up @@ -61,7 +65,7 @@ protected function configure()
/**
* @inheritDoc
*/
protected function initialize(InputInterface $input, OutputInterface $output)
protected function initialize(InputInterface $input, OutputInterface $output): void
{
$input->setOption('format', 'annotation');

Expand All @@ -76,7 +80,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$questionHelper = $this->getQuestionHelper();

Expand Down Expand Up @@ -106,7 +110,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$questionHelper->writeGeneratorSummary($output, $errors);

return 0;
return Command::SUCCESS;
}

protected function checkBundleSearchDirectory(Bundle $bundle)
Expand Down