Test Failed
Pull Request — master (#315)
by Sergei
03:20
created

BinaryColumnSchema   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 3
c 1
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A phpTypecast() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Pgsql\Column;
6
7
use Yiisoft\Db\Schema\Column\BinaryColumnSchema as BaseBinaryColumnSchema;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\Column\BinaryColumnSchema 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...
8
9
use function hex2bin;
10
use function is_string;
11
use function str_starts_with;
12
use function substr;
13
14
final class BinaryColumnSchema extends BaseBinaryColumnSchema
15
{
16
    public function phpTypecast(mixed $value): mixed
17
    {
18
        if (is_string($value) && str_starts_with($value, '\x')) {
19
            return hex2bin(substr($value, 2));
20
        }
21
22
        return $value;
23
    }
24
}
25