Skip to content

Commit

Permalink
minor silexphp#130 Simplify extend calls (hkdobrev)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Simplify extend calls

Since Pimple 2.x there is no need to re-assign the result from the extend() call to the same key. Pimple already does that.

Commits
-------

19989b3 Simplify extend calls
  • Loading branch information
fabpot committed Apr 4, 2018
2 parents 30bfe7d + 19989b3 commit 0b56bca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions WebProfilerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function register(Container $app)
}

if (class_exists('Symfony\Bridge\Twig\Extension\ProfilerExtension')) {
$app['data_collectors'] = $app->extend('data_collectors', function ($collectors, $app) {
$app->extend('data_collectors', function ($collectors, $app) {
$collectors['twig'] = function ($app) {
return new TwigDataCollector($app['twig.profiler.profile'], $app['twig']);
};
Expand All @@ -154,7 +154,7 @@ public function register(Container $app)
return new DumpListener($app['var_dumper.cloner'], $app['var_dumper.data_collector']);
};

$app['data_collectors'] = $app->extend('data_collectors', function ($collectors, $app) {
$app->extend('data_collectors', function ($collectors, $app) {
if ($app['profiler.templates_path.debug']) {
$collectors['dump'] = function ($app) {
$dumper = null === $app['var_dumper.dump_destination'] ? null : $app['var_dumper.cli_dumper'];
Expand All @@ -168,7 +168,7 @@ public function register(Container $app)
}

if (class_exists('Symfony\Component\HttpKernel\DataCollector\AjaxDataCollector')) {
$app['data_collectors'] = $app->extend('data_collectors', function ($collectors, $app) {
$app->extend('data_collectors', function ($collectors, $app) {
$collectors['ajax'] = function ($app) {
return new AjaxDataCollector();
};
Expand Down Expand Up @@ -223,7 +223,7 @@ public function register(Container $app)
}

if (isset($app['translator']) && class_exists('Symfony\Component\Translation\DataCollector\TranslationDataCollector')) {
$app['data_collectors'] = $app->extend('data_collectors', function ($collectors, $app) {
$app->extend('data_collectors', function ($collectors, $app) {
$collectors['translation'] = function ($app) {
return new TranslationDataCollector($app['translator']);
};
Expand Down

0 comments on commit 0b56bca

Please sign in to comment.