Passed
Push — lexer1 ( 54a5b3...04fbeb )
by Martin
44:16 queued 29:14
created

DoctrineLexer::isPre200()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 1
eloc 1
c 1
b 1
f 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Utils;
6
7
use Doctrine\ORM\Query\Lexer;
8
9
/**
10
 * @internal
11
 */
12
final class DoctrineLexer
13
{
14 20
    public static function isPre200(Lexer $lexer): bool
15
    {
16
        // @phpstan-ignore-next-line
17 20
        return \is_array($lexer->lookahead);
18
    }
19
20
    /**
21
     * @return mixed|null
22
     */
23 20
    public static function getLookaheadType(Lexer $lexer)
24
    {
25 20
        if (self::isPre200($lexer)) {
26
            // @phpstan-ignore-next-line
27
            return $lexer->lookahead['type'];
28
        }
29
30
        // @phpstan-ignore-next-line
31 20
        return $lexer->lookahead?->type;
32
    }
33
}
34