| 1 | <?php |
||
| 7 | class ArticlePresenter extends Presenter |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Edit link of the article. |
||
| 11 | * |
||
| 12 | * @return string |
||
| 13 | */ |
||
| 14 | public function editLink() |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Date created. |
||
| 21 | * |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | public function dateCreated() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Date published. |
||
| 31 | * |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | public function datePublished() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Publication state. |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | public function published() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Get article's author name. |
||
| 54 | * |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | public function author() |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get the article's content. |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | * @throws \Exception |
||
| 69 | * @throws \Throwable |
||
| 70 | */ |
||
| 71 | public function content() |
||
| 77 | } |
||
| 78 |
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: