| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class DActiveRecord extends ActiveRecord |
||
| 9 | { |
||
| 10 | /** in case we would need to customize stuff */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | public static function primaryKey() |
||
| 18 | } |
||
| 19 | |||
| 20 | |||
| 21 | /** {@inheritdoc} */ |
||
| 22 | public function hasMany($class, $link = null) |
||
| 23 | { |
||
| 24 | if (empty($link)) { |
||
| 25 | /** @var DActiveRecord $class */ |
||
| 26 | $link = [$class::primaryKey() => $class::primaryKey()]; |
||
| 27 | } |
||
| 28 | return parent::hasMany($class, $link); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** {@inheritdoc} */ |
||
| 32 | public function hasOne($class, $link = null) |
||
| 39 | } |
||
| 40 | } |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: