1 | <?php namespace Cviebrock\EloquentSluggable; |
||
12 | class SluggableObserver |
||
13 | { |
||
14 | |||
15 | /** @var string */ |
||
16 | public const SAVING = 'saving'; |
||
17 | |||
18 | /** @var string */ |
||
19 | public const SAVED = 'saved'; |
||
20 | |||
21 | /** |
||
22 | * @var \Cviebrock\EloquentSluggable\Services\SlugService |
||
23 | */ |
||
24 | private $slugService; |
||
25 | |||
26 | /** |
||
27 | * @var \Illuminate\Contracts\Events\Dispatcher |
||
28 | */ |
||
29 | private $events; |
||
30 | |||
31 | /** |
||
32 | * SluggableObserver constructor. |
||
33 | * |
||
34 | * @param \Cviebrock\EloquentSluggable\Services\SlugService $slugService |
||
35 | * @param \Illuminate\Contracts\Events\Dispatcher $events |
||
36 | */ |
||
37 | public function __construct(SlugService $slugService, Dispatcher $events) |
||
42 | |||
43 | /** |
||
44 | * @param \Illuminate\Database\Eloquent\Model $model |
||
45 | * @return bool|void |
||
46 | */ |
||
47 | public function saving(Model $model) |
||
55 | |||
56 | /** |
||
57 | * @param \Illuminate\Database\Eloquent\Model $model |
||
58 | * @return bool|void |
||
59 | */ |
||
60 | public function saved(Model $model) |
||
69 | |||
70 | /** |
||
71 | * @param \Illuminate\Database\Eloquent\Model $model |
||
72 | * @param string $event |
||
73 | * @return bool |
||
74 | */ |
||
75 | protected function generateSlug(Model $model, string $event): bool |
||
87 | |||
88 | /** |
||
89 | * Fire the namespaced validating event. |
||
90 | * |
||
91 | * @param \Illuminate\Database\Eloquent\Model $model |
||
92 | * @param string $event |
||
93 | * @return array|null |
||
94 | */ |
||
95 | protected function fireSluggingEvent(Model $model, string $event): ?array |
||
99 | |||
100 | /** |
||
101 | * Fire the namespaced post-validation event. |
||
102 | * |
||
103 | * @param \Illuminate\Database\Eloquent\Model $model |
||
104 | * @param string $status |
||
105 | * @return void |
||
106 | */ |
||
107 | protected function fireSluggedEvent(Model $model, string $status): void |
||
111 | } |
||
112 |
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: