Passed
Push — master ( f75c84...6aec09 )
by Anton
02:54
created

Migration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 2
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getConnection() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Love.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Love\Support\Database;
15
16
use Illuminate\Database\Migrations\Migration as IlluminateMigration;
17
use Illuminate\Support\Facades\Config;
18
use Illuminate\Support\Facades\Schema;
19
20
abstract class Migration extends IlluminateMigration
21
{
22
    /**
23
     * The database schema.
24
     *
25
     * @var \Illuminate\Support\Facades\Schema
26
     */
27
    protected $schema;
28
29
    public function __construct()
30
    {
31
        $this->schema = Schema::connection($this->getConnection());
0 ignored issues
show
Documentation Bug introduced by
It seems like Illuminate\Support\Facad...$this->getConnection()) of type Illuminate\Database\Schema\Builder is incompatible with the declared type Illuminate\Support\Facades\Schema of property $schema.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
32
    }
33
34
    /**
35
     * Get the migration connection name.
36
     *
37
     * @return null|string
38
     */
39
    public function getConnection(): ?string
40
    {
41
        return Config::get('love.storage.database.connection');
42
    }
43
}
44