Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function build(ExpressionInterface $expression, array &$params = []) |
||
28 | { |
||
29 | $params = array_merge($params, $expression->params); |
||
|
|||
30 | $string = $expression->__toString(); |
||
31 | |||
32 | static $expressionMap = [ |
||
33 | "strftime('%Y')" => "EXTRACT(YEAR FROM TIMESTAMP 'now')" |
||
34 | ]; |
||
35 | |||
36 | if (isset($expressionMap[$string])) { |
||
37 | return $expressionMap[$string]; |
||
38 | } |
||
39 | |||
40 | return $string; |
||
41 | } |
||
42 | } |
||
43 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: