Passed
Pull Request — master (#8)
by
unknown
01:30
created

CreateCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 9
ccs 0
cts 9
cp 0
crap 2
rs 10
1
<?php
2
namespace Yiisoft\Yii\Cycle\Command;
3
4
use Symfony\Component\Console\Input\InputArgument;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
class CreateCommand extends BaseMigrationCommand
9
{
10
    protected static $defaultName = 'migrate/create';
11
12
    public function configure(): void
13
    {
14
        $this->setDescription('Create an empty migration')
15
             ->setHelp('This command allows you to create a custom migration')
16
             ->addArgument('name', InputArgument::REQUIRED, 'Migration name');
17
    }
18
19
    protected function execute(InputInterface $input, OutputInterface $output): void
20
    {
21
        $customName = $input->getArgument('name');
22
23
        $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

23
        $this->createEmptyMigration($output, /** @scrutinizer ignore-type */ $customName);
Loading history...
24
    }
25
}
26