| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function validateAttribute($model, $attribute) |
||
| 24 | { |
||
| 25 | $oldValue = $model->$attribute; |
||
| 26 | |||
| 27 | $newModel = $this->createModel($model->$attribute); |
||
| 28 | $model->$attribute = $newModel; |
||
| 29 | |||
| 30 | $validationResult = parent::validateAttribute($model, $attribute); |
||
|
|
|||
| 31 | if ($validationResult === null) { |
||
| 32 | return null; |
||
| 33 | } |
||
| 34 | |||
| 35 | $model->$attribute = $oldValue; |
||
| 36 | |||
| 37 | return $validationResult; |
||
| 38 | } |
||
| 39 | |||
| 65 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.