| Conditions | 7 |
| Paths | 12 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | public static function find() |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var $obj ActiveRecord |
||
| 12 | */ |
||
| 13 | $obj = new static; |
||
| 14 | $class = new \ReflectionClass($obj); |
||
| 15 | $condition = []; |
||
| 16 | foreach ($class->getProperties(\ReflectionProperty::IS_STATIC) as $property) { |
||
| 17 | if (strpos($property->getName(), 'BEFORE_QUERY') !== false && is_array($property->getValue($obj))) { |
||
| 18 | $params = $property->getValue($obj); |
||
| 19 | foreach($params as $key => $value){ |
||
| 20 | $params[$obj::tableName().'.'.$key] = $value; |
||
| 21 | unset($params[$key]); |
||
| 22 | } |
||
| 23 | $condition = array_merge($condition, $params); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | if ($obj->hasAttribute($obj->removedAttribute)) |
||
| 28 | return (new DynamicQuery($obj))->findRemoved()->andFilterWhere($condition); |
||
| 29 | elseif ($obj->isNestedSet()) |
||
| 30 | return (new DynamicQuery($obj))->andFilterWhere($condition); |
||
| 31 | else |
||
| 32 | return parent::find()->andFilterWhere($condition); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: