Passed
Push — master ( a39d50...8807b4 )
by Wilmer
03:04
created

Schema::getLastInsertID()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Support\Stub;
6
7
use Yiisoft\Db\Constraint\Constraint;
8
use Yiisoft\Db\Exception\NotSupportedException;
9
use Yiisoft\Db\Schema\ColumnSchemaBuilder;
10
use Yiisoft\Db\Schema\SchemaInterface;
11
use Yiisoft\Db\Schema\TableSchemaInterface;
12
13
final class Schema extends \Yiisoft\Db\Schema\Schema implements SchemaInterface
14
{
15
    public function createColumnSchemaBuilder(string $type, array|int|string $length = null): ColumnSchemaBuilder
16
    {
17
        return new ColumnSchemaBuilder($type, $length);
18
    }
19
20
    public function findUniqueIndexes(TableSchemaInterface $table): array
21
    {
22
        return $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
23
    }
24
25
    public function getLastInsertID(string $sequenceName = null): string
0 ignored issues
show
Unused Code introduced by
The parameter $sequenceName is not used and could be removed. ( Ignorable by Annotation )

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

25
    public function getLastInsertID(/** @scrutinizer ignore-unused */ string $sequenceName = null): string

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
28
    }
29
30
    protected function getCacheKey(string $name): array
31
    {
32
        throw new NotSupportedException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
33
    }
34
35
    protected function getCacheTag(): string
36
    {
37
        throw new NotSupportedException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
38
    }
39
40
    protected function loadTableChecks(string $tableName): array
41
    {
42
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
43
    }
44
45
    protected function loadTableDefaultValues(string $tableName): array
46
    {
47
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
48
    }
49
50
    protected function loadTableForeignKeys(string $tableName): array
51
    {
52
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
53
    }
54
55
    protected function loadTableIndexes(string $tableName): array
56
    {
57
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
58
    }
59
60
    protected function loadTablePrimaryKey(string $tableName): Constraint|null
61
    {
62
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
63
    }
64
65
    protected function loadTableUniques(string $tableName): array
66
    {
67
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
68
    }
69
70
    protected function loadTableSchema(string $name): TableSchemaInterface|null
71
    {
72
        $this->getException(self::class . '::' . __METHOD__ . '()' . ' is not supported by core-db.');
73
    }
74
75
    private function getException(string $message): void
76
    {
77
        throw new NotSupportedException($message);
78
    }
79
}
80