| Conditions | 4 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 17 | public function register() |
||
| 18 | { |
||
| 19 | $this->app['events']->listen('eloquent.saved*', function ($model) { |
||
| 20 | if ($model instanceof HasUrlInterface) { |
||
| 21 | $model->saveUri(); |
||
| 22 | } |
||
| 23 | }); |
||
| 24 | |||
| 25 | $this->app['events']->listen('eloquent.deleted*', function ($model) { |
||
| 26 | if ($model instanceof HasUrlInterface && $model->url) { |
||
|
1 ignored issue
–
show
|
|||
| 27 | $model->url->delete(); |
||
|
1 ignored issue
–
show
|
|||
| 28 | } |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |
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: