Passed
Push — master ( 227314...d8a269 )
by Alexander
14:02
created

CreateCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command\Migration;
6
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Yiisoft\Yii\Console\ExitCode;
11
12
final class CreateCommand extends BaseMigrationCommand
13
{
14
    protected static $defaultName = 'migrate/create';
15
16
    public function configure(): void
17
    {
18
        $this->setDescription('Create an empty migration')
19
             ->setHelp('This command allows you to create a custom migration')
20
             ->addArgument('name', InputArgument::REQUIRED, 'Migration name');
21
    }
22
23
    protected function execute(InputInterface $input, OutputInterface $output): int
24
    {
25
        $customName = $input->getArgument('name');
26
27
        $this->createEmptyMigration($output, $customName);
0 ignored issues
show
Bug introduced by
It seems like $customName can also be of type null and string[]; however, parameter $name of Yiisoft\Yii\Cycle\Comman...:createEmptyMigration() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
        $this->createEmptyMigration($output, /** @scrutinizer ignore-type */ $customName);
Loading history...
28
29
        return ExitCode::OK;
30
    }
31
}
32