for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the overtrue/laravel-shopping-cart.
*
* (c) 2016 overtrue <[email protected]>
*/
namespace Overtrue\LaravelShoppingCart;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
/**
* Service provider for Laravel.
class ServiceProvider extends LaravelServiceProvider
{
* Indicates if loading of the provider is deferred.
* @var bool
protected $defer = true;
* Boot the provider.
public function boot()
//
}
* Register the service provider.
public function register()
$this->app->singleton([Cart::class => 'cart'], function ($app) {
array(\Overtrue\LaravelS...\Cart::class => 'cart')
array<string|integer,string>
string
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
return new Cart($app['session'], $app['events']);
});
* Get the services provided by the provider.
* @return array
public function provides()
return [Cart::class, 'cart'];
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: