These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Modules\Tag\Providers; |
||
4 | |||
5 | use Illuminate\Support\ServiceProvider; |
||
6 | use Modules\Core\Traits\CanPublishConfiguration; |
||
7 | use Modules\Tag\Display\TagWidget; |
||
8 | use Modules\Tag\Entities\Tag; |
||
9 | use Modules\Tag\Repositories\Cache\CacheTagDecorator; |
||
10 | use Modules\Tag\Repositories\Eloquent\EloquentTagRepository; |
||
11 | use Modules\Tag\Repositories\TagManager; |
||
12 | use Modules\Tag\Repositories\TagManagerRepository; |
||
13 | use Modules\Tag\Repositories\TagRepository; |
||
14 | |||
15 | class TagServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | use CanPublishConfiguration; |
||
18 | /** |
||
19 | * Indicates if loading of the provider is deferred. |
||
20 | * |
||
21 | * @var bool |
||
22 | */ |
||
23 | protected $defer = false; |
||
24 | |||
25 | /** |
||
26 | * Register the service provider. |
||
27 | * |
||
28 | * @return void |
||
29 | */ |
||
30 | public function register() |
||
31 | { |
||
32 | $this->registerBindings(); |
||
33 | |||
34 | $this->app->singleton('tag.widget', function ($app) { |
||
35 | return new TagWidget($app[TagRepository::class]); |
||
36 | }); |
||
37 | } |
||
38 | |||
39 | public function boot() |
||
40 | { |
||
41 | $this->publishConfig('tag', 'permissions'); |
||
42 | $this->registerBladeTags(); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Get the services provided by the provider. |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | public function provides() |
||
51 | { |
||
52 | return array(); |
||
53 | } |
||
54 | |||
55 | private function registerBindings() |
||
56 | { |
||
57 | $this->app->bind(TagRepository::class, function () { |
||
58 | $repository = new EloquentTagRepository(new Tag()); |
||
1 ignored issue
–
show
|
|||
59 | |||
60 | if (! config('app.cache')) { |
||
61 | return $repository; |
||
62 | } |
||
63 | |||
64 | return new CacheTagDecorator($repository); |
||
65 | }); |
||
66 | |||
67 | $this->app->singleton(TagManager::class, function () { |
||
68 | return new TagManagerRepository(); |
||
69 | }); |
||
70 | } |
||
71 | |||
72 | protected function registerBladeTags() |
||
73 | { |
||
74 | if (app()->environment() === 'testing') { |
||
75 | return; |
||
76 | } |
||
77 | $this->app['blade.compiler']->directive('tags', function ($value) { |
||
78 | return "<?php echo TagWidget::show(array$value); ?>"; |
||
79 | }); |
||
80 | } |
||
81 | } |
||
82 |
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: