Skip to content

Commit d2c326b

Browse files
LeoYang90taylorotwell
authored andcommitted
Fix the position of bound() in Container::instance() (#19207)
* fix:change the position of bound() in instance() to prevent that rebound() always fires incorrectly.More detail can see issues #19194 * failing test for change * fix:rename the variable
1 parent f7fc83a commit d2c326b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Container.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,16 @@ public function instance($abstract, $instance)
357357
{
358358
$this->removeAbstractAlias($abstract);
359359

360+
$isBound = $this->bound($abstract);
361+
360362
unset($this->aliases[$abstract]);
361363

362364
// We'll check to determine if this type has been bound before, and if it has
363365
// we will fire the rebound callbacks registered with the container and it
364366
// can be updated with consuming classes that have gotten resolved here.
365367
$this->instances[$abstract] = $instance;
366368

367-
if ($this->bound($abstract)) {
369+
if ($isBound) {
368370
$this->rebound($abstract);
369371
}
370372
}

0 commit comments

Comments
 (0)