Prefer passing class name when binding new shared instances

This commit is contained in:
QWp6t
2016-12-24 23:45:05 -08:00
parent 5d454ba8ed
commit 121e3f20d7

View File

@@ -16,11 +16,12 @@ class BladeProvider extends ViewServiceProvider
/** /**
* @param ContainerContract $container * @param ContainerContract $container
* @param array $config * @param array $config
* @SuppressWarnings(PHPMD.StaticAccess)
*/ */
public function __construct(ContainerContract $container = null, $config = []) public function __construct(ContainerContract $container = null, $config = [])
{ {
/** @noinspection PhpParamsInspection */ /** @noinspection PhpParamsInspection */
parent::__construct($container ?: new Container); parent::__construct($container ?: Container::getInstance());
$this->app->bindIf('config', function () use ($config) { $this->app->bindIf('config', function () use ($config) {
return $config; return $config;
@@ -45,9 +46,7 @@ class BladeProvider extends ViewServiceProvider
*/ */
public function registerFilesystem() public function registerFilesystem()
{ {
$this->app->bindIf('files', function () { $this->app->bindIf('files', Filesystem::class, true);
return new Filesystem;
}, true);
return $this; return $this;
} }
@@ -56,9 +55,7 @@ class BladeProvider extends ViewServiceProvider
*/ */
public function registerEvents() public function registerEvents()
{ {
$this->app->bindIf('events', function () { $this->app->bindIf('events', Dispatcher::class, true);
return new Dispatcher;
}, true);
return $this; return $this;
} }