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

CreateCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
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