1 | <?php |
||
7 | class PostObserver |
||
8 | { |
||
9 | /** |
||
10 | * Handle the post "saving" event. |
||
11 | * |
||
12 | * @param \Chriscreates\Blog\Post $post |
||
13 | * @return void |
||
14 | */ |
||
15 | public function saving(Post $post) |
||
37 | |||
38 | /** |
||
39 | * Handle the post "deleting" event. |
||
40 | * |
||
41 | * @param \Chriscreates\Blog\Post $post |
||
42 | * @return void |
||
43 | */ |
||
44 | public function deleting(Post $post) |
||
50 | } |
||
51 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: