Comparator::diffTable()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
cc 3
nc 2
nop 2
crap 3
1
<?php
2
3
namespace Bdf\Prime\Schema;
4
5
use Doctrine\DBAL\Schema\Comparator as BaseComparator;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Schema\Comparator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Doctrine\DBAL\Schema\Table as BaseTable;
7
8
/**
9
 * Schema comparator
10
 *
11
 * @package Bdf\Prime\Schema
12
 *
13
 * @deprecated since 1.3 Use Prime comparators instead
14
 */
15
class Comparator extends BaseComparator
16
{
17
    /**
18
     * Allow diff to list drop column
19
     *
20
     * @var bool
21
     */
22
    protected $listDropColumn = true;
23
24
    /**
25
     * Set flag that allowed diff to list drop columns
26
     *
27
     * @param bool $flag
28
     *
29
     * @return void
30
     */
31 124
    public function setListDropColumn($flag): void
32
    {
33 124
        $this->listDropColumn = (bool)$flag;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 124
    public function diffTable(BaseTable $fromTable, BaseTable $toTable)
40
    {
41 124
        $diff = parent::diffTable($fromTable, $toTable);
42
43 124
        if ($diff && !$this->listDropColumn) {
44
            /** @psalm-suppress InternalProperty */
45 1
            $diff->removedColumns = [];
46
        }
47
48 124
        return $diff;
49
    }
50
}
51