Passed
Push — master ( 9d7627...6e03ab )
by Paweł
02:19
created

DatabaseRecreatableTrait::recreateDatabaseSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2020.
4
 * @author Paweł Antosiak <[email protected]>
5
 */
6
7
declare(strict_types=1);
8
9
namespace Gorynych\Testing;
10
11
use Gorynych\Adapter\EntityManagerAdapterInterface;
12
13
trait DatabaseRecreatableTrait
14
{
15
    protected static ?EntityManagerAdapterInterface $entityManager;
16
17
    protected static function recreateDatabaseSchema(): void
18
    {
19
        static::dropDatabaseSchema();
20
        static::$entityManager->createSchema();
0 ignored issues
show
Bug introduced by
The method createSchema() does not exist on null. ( Ignorable by Annotation )

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

20
        static::$entityManager->/** @scrutinizer ignore-call */ 
21
                                createSchema();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
    }
22
23
    protected static function dropDatabaseSchema(): void
24
    {
25
        static::$entityManager->dropSchema();
26
    }
27
}
28