Completed
Push — master ( c1a156...8cadde )
by Kirill
08:14
created

SDLGrammarCompileCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Console;
11
12
use Railt\Compiler\Compiler;
13
use Railt\Console\Command;
14
use Railt\Io\File;
15
16
/**
17
 * Class SDLCompileCommand
18
 */
19
class SDLGrammarCompileCommand extends Command
20
{
21
    /**
22
     * @var string
23
     */
24
    private const SCHEMA_SDL_GRAMMAR = __DIR__ . '/../../resources/grammar.pp2';
25
26
    /**
27
     * @var string
28
     */
29
    protected $signature = 'sdl:grammar:compile';
30
31
    /**
32
     * @var string
33
     */
34
    protected $description = 'Compile GraphQL SDL Parser';
35
36
    /**
37
     * @throws \Railt\Io\Exception\ExternalFileException
38
     * @throws \Railt\Io\Exception\NotReadableException
39
     * @throws \Throwable
40
     */
41
    public function handle(): void
42
    {
43
        Compiler::load(File::fromPathname(self::SCHEMA_SDL_GRAMMAR))
0 ignored issues
show
Bug introduced by
It seems like \Railt\Io\File::fromPath...lf::SCHEMA_SDL_GRAMMAR) targeting Railt\Io\File::fromPathname() can also be of type object<Railt\Io\File>; however, Railt\Compiler\Compiler::load() does only seem to accept object<Railt\Io\Readable>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
44
            ->setClassName('Parser')
45
            ->setNamespace('Railt\\SDL\\Compiler')
46
            ->saveTo(__DIR__ . '/../Compiler');
47
48
        $this->info('OK');
49
    }
50
}
51