Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 8, 2021
1 parent 79a0961 commit 2971b64
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Container/Container.php
Expand Up @@ -1349,7 +1349,7 @@ public function forgetInstances()
*
* @return void
*/
public function resetScope()
public function forgetScopedInstances()
{
foreach ($this->scopedInstances as $scoped) {
unset($this->instances[$scoped]);
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Queue/QueueServiceProvider.php
Expand Up @@ -166,16 +166,16 @@ protected function registerWorker()
return $this->app->isDownForMaintenance();
};

$scopeResetter = function () use ($app) {
return $app->resetScope();
$resetScope = function () use ($app) {
return $app->forgetScopedInstances();
};

return new Worker(
$app['queue'],
$app['events'],
$app[ExceptionHandler::class],
$isDownForMaintenance,
$scopeResetter
$resetScope
);
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/Illuminate/Queue/Worker.php
Expand Up @@ -66,11 +66,11 @@ class Worker
protected $isDownForMaintenance;

/**
* The callback used to reset the application scope.
* The callback used to reset the application's scope.
*
* @var callable
*/
protected $scopeResetter;
protected $resetScope;

/**
* Indicates if the worker should exit.
Expand Down Expand Up @@ -100,20 +100,20 @@ class Worker
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @param \Illuminate\Contracts\Debug\ExceptionHandler $exceptions
* @param callable $isDownForMaintenance
* @param callable|null $scopeResetter
* @param callable|null $resetScope
* @return void
*/
public function __construct(QueueManager $manager,
Dispatcher $events,
ExceptionHandler $exceptions,
callable $isDownForMaintenance,
callable $scopeResetter = null)
callable $resetScope = null)
{
$this->events = $events;
$this->manager = $manager;
$this->exceptions = $exceptions;
$this->isDownForMaintenance = $isDownForMaintenance;
$this->scopeResetter = $scopeResetter;
$this->resetScope = $resetScope;
}

/**
Expand Down Expand Up @@ -148,8 +148,8 @@ public function daemon($connectionName, $queue, WorkerOptions $options)
continue;
}

if (isset($this->scopeResetter)) {
($this->scopeResetter)();
if (isset($this->resetScope)) {
($this->resetScope)();
}

// First, we will attempt to get the next job off of the queue. We will also
Expand Down
4 changes: 2 additions & 2 deletions tests/Container/ContainerTest.php
Expand Up @@ -125,7 +125,7 @@ public function testScopedClosureResets()
});
$firstInstantiation = $container->make('class');

$container->resetScope();
$container->forgetScopedInstances();

$secondInstantiation = $container->make('class');
$this->assertNotSame($firstInstantiation, $secondInstantiation);
Expand Down Expand Up @@ -154,7 +154,7 @@ public function testScopedConcreteResolutionResets()

$var1 = $container->make(ContainerConcreteStub::class);

$container->resetScope();
$container->forgetScopedInstances();

$var2 = $container->make(ContainerConcreteStub::class);

Expand Down

0 comments on commit 2971b64

Please sign in to comment.