These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @link http://www.yiiframework.com/ |
||
4 | * @copyright Copyright (c) 2008 Yii Software LLC |
||
5 | * @license http://www.yiiframework.com/license/ |
||
6 | */ |
||
7 | |||
8 | namespace edgardmessias\db\firebird; |
||
9 | |||
10 | use yii\db\Expression; |
||
11 | |||
12 | /** |
||
13 | * |
||
14 | * @author Edgard Lorraine Messias <[email protected]> |
||
15 | * @since 2.0 |
||
16 | */ |
||
17 | class ColumnSchema extends \yii\db\ColumnSchema |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * Converts the input value according to [[phpType]] after retrieval from the database. |
||
22 | * If the value is null or an [[Expression]], it will not be converted. |
||
23 | * @param mixed $value input value |
||
24 | * @return mixed converted value |
||
25 | * @since 2.0.3 |
||
26 | */ |
||
27 | 98 | protected function typecast($value) |
|
28 | { |
||
29 | |||
30 | 98 | if ($value === '' && $this->type !== Schema::TYPE_TEXT && $this->type !== Schema::TYPE_STRING && $this->type !== Schema::TYPE_BINARY) { |
|
31 | 1 | return null; |
|
32 | } |
||
33 | 98 | if ($value instanceof ExpressionInterface) { |
|
0 ignored issues
–
show
|
|||
34 | 94 | return $value; |
|
35 | } |
||
36 | if ($value === null || gettype($value) === $this->phpType || $value instanceof Expression) { |
||
37 | 87 | return $value; |
|
38 | 87 | } |
|
39 | 87 | ||
40 | 42 | switch ($this->phpType) { |
|
41 | case 'resource': |
||
42 | case 'string': |
||
43 | 42 | if (is_resource($value)) { |
|
44 | return $value; |
||
45 | 2 | } |
|
46 | if (is_float($value)) { |
||
47 | 42 | // ensure type cast always has . as decimal separator in all locales |
|
48 | 63 | return str_replace(',', '.', (string) $value); |
|
49 | 63 | } |
|
50 | 3 | return (string) $value; |
|
51 | case 'integer': |
||
52 | 63 | if (is_bool($value)) { |
|
53 | 16 | return ($value) ? 1 : 0; |
|
54 | } |
||
55 | 16 | return (int) $value; |
|
56 | 16 | case 'boolean': |
|
57 | return (boolean) $value; |
||
58 | case 'double': |
||
59 | return (double) $value; |
||
60 | } |
||
61 | |||
62 | return $value; |
||
63 | } |
||
64 | } |
||
65 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.