| Conditions | 2 |
| Paths | 1 |
| Total Lines | 30 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function register() |
||
| 11 | { |
||
| 12 | Menu::macro('front', function () { |
||
| 13 | return Menu::new()->setActiveFromRequest(locale()); |
||
| 14 | }); |
||
| 15 | |||
| 16 | Menu::macro('main', function () { |
||
| 17 | return Menu::front() |
||
| 18 | ->addClass('nav__list') |
||
| 19 | ->url('/', 'Home'); |
||
| 20 | }); |
||
| 21 | |||
| 22 | Menu::macro('language', function () { |
||
| 23 | return Menu::build(locales(), function (Menu $menu, string $locale) { |
||
|
|
|||
| 24 | return $menu->url($locale, strtoupper($locale)); |
||
| 25 | })->setActiveFromRequest(); |
||
| 26 | }); |
||
| 27 | |||
| 28 | Menu::macro('articleSiblings', function (Article $article) { |
||
| 29 | return $article->siblings->reduce(function (Menu $menu, Article $article) { |
||
| 30 | return $menu->url($article->url, $article->name); |
||
| 31 | }, Menu::front()); |
||
| 32 | }); |
||
| 33 | |||
| 34 | Menu::macro('article', function ($article) { |
||
| 35 | $article = $article instanceof Article ? $article : article($article); |
||
| 36 | |||
| 37 | return $this->url($article->url, $article->name); |
||
| 38 | }); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
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: