Test Failed
Pull Request — master (#235)
by Def
05:41 queued 02:41
created

Column   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDefault() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Mssql;
6
7
use Yiisoft\Db\Expression\Expression;
8
use Yiisoft\Db\Schema\Builder\AbstractColumn;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\Builder\AbstractColumn 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...
9
10
/**
11
 * It's a utility that provides a convenient way to create column schema for use with {@see Schema}
12
 * for MSSQL Server.
13
 *
14
 * It provides methods for specifying the properties of a column, such as its type, size, default value, and whether it
15
 * is nullable or not. It also provides a method for creating a column schema based on the specified properties.
16
 *
17
 * For example, the following code creates a column schema for an integer column:
18
 *
19
 * ```php
20
 * $column = (new Column(SchemaInterface::TYPE_INTEGER))->notNull()->defaultValue(0);
21
 * ```
22
 *
23
 * Provides a fluent interface, which means that the methods can be chained together to create a column schema with
24
 * many properties in a single line of code.
25
 */
26
final class Column extends AbstractColumn
27
{
28
    /**
29
     * @return Expression|string|null The default value of the column
30
     */
31
    public function getDefault(): Expression|string|null
32
    {
33
        if ($this->default instanceof Expression) {
34
            return $this->default;
35
        }
36
37
        return $this->buildDefaultValue();
38
    }
39
}
40