Issues (902)

framework/db/ExpressionBuilder.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * @link https://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license https://www.yiiframework.com/license/
6
 */
7
8
namespace yii\db;
9
10
/**
11
 * Class ExpressionBuilder builds objects of [[yii\db\Expression]] class.
12
 *
13
 * @author Dmitry Naumenko <[email protected]>
14
 * @since 2.0.14
15
 */
16
class ExpressionBuilder implements ExpressionBuilderInterface
17
{
18
    use ExpressionBuilderTrait;
19
20
21
    /**
22
     * {@inheritdoc}
23
     * @param Expression|ExpressionInterface $expression the expression to be built
24
     */
25 389
    public function build(ExpressionInterface $expression, array &$params = [])
26
    {
27 389
        $params = array_merge($params, $expression->params);
0 ignored issues
show
Accessing params on the interface yii\db\ExpressionInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
28 389
        return $expression->__toString();
0 ignored issues
show
The method __toString() does not exist on yii\db\ExpressionInterface. It seems like you code against a sub-type of yii\db\ExpressionInterface such as yii\db\Query or yii\db\Expression. ( Ignorable by Annotation )

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

28
        return $expression->/** @scrutinizer ignore-call */ __toString();
Loading history...
29
    }
30
}
31