Skip to content

Commit 0d8faf3

Browse files
neclimduldriesvintsGrahamCampbelltaylorotwell
authored
[7.x] Slight optimization to mergeConfigFrom (#33493)
* Slight optimization to mergeConfigFrom For cold starts and lumen, this avoids 2 magic method calls to ArrayInterface and one make call which itself has a bit of logic. This should not affect laravel with config caching but config is in a hot path for requests in lumen it is a small change that could add up. * Update ServiceProvider.php * Update ServiceProvider.php * Update ServiceProvider.php Co-authored-by: Dries Vints <[email protected]> Co-authored-by: Graham Campbell <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent 737b639 commit 0d8faf3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Illuminate/Support/ServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ public function register()
6363
protected function mergeConfigFrom($path, $key)
6464
{
6565
if (! ($this->app instanceof CachesConfiguration && $this->app->configurationIsCached())) {
66-
$this->app['config']->set($key, array_merge(
67-
require $path, $this->app['config']->get($key, [])
66+
$config = $this->app->make('config');
67+
68+
$config->set($key, array_merge(
69+
require $path, $config->get($key, [])
6870
));
6971
}
7072
}

0 commit comments

Comments
 (0)