Skip to content

Commit 5eb1215

Browse files
authored
Revert "[11.x] Declare bindings and singletons properties in Service Provider…" (#52288)
This reverts commit ed28a45.
1 parent 36ad970 commit 5eb1215

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -870,14 +870,18 @@ public function register($provider, $force = false)
870870
// If there are bindings / singletons set as properties on the provider we
871871
// will spin through them and register them with the application, which
872872
// serves as a convenience layer while registering a lot of bindings.
873-
foreach ($provider->bindings as $key => $value) {
874-
$this->bind($key, $value);
873+
if (property_exists($provider, 'bindings')) {
874+
foreach ($provider->bindings as $key => $value) {
875+
$this->bind($key, $value);
876+
}
875877
}
876878

877-
foreach ($provider->singletons as $key => $value) {
878-
$key = is_int($key) ? $value : $key;
879+
if (property_exists($provider, 'singletons')) {
880+
foreach ($provider->singletons as $key => $value) {
881+
$key = is_int($key) ? $value : $key;
879882

880-
$this->singleton($key, $value);
883+
$this->singleton($key, $value);
884+
}
881885
}
882886

883887
$this->markAsRegistered($provider);

src/Illuminate/Support/ServiceProvider.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@ abstract class ServiceProvider
1919
*/
2020
protected $app;
2121

22-
/**
23-
* All of the container bindings that should be registered.
24-
*
25-
* @var array
26-
*/
27-
public $bindings = [];
28-
29-
/**
30-
* All of the singletons that should be registered.
31-
*
32-
* @var array
33-
*/
34-
public $singletons = [];
35-
3622
/**
3723
* All of the registered booting callbacks.
3824
*

0 commit comments

Comments
 (0)