8000 [12.x] Container `currentlyResolving` utility (#55684) · laravel/framework@7771d14 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7771d14

Browse files
[12.x] Container currentlyResolving utility (#55684)
* container `currentlyResolving` utility * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent b0f6227 commit 7771d14

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Illuminate/Container/Container.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,16 @@ protected function fireCallbackArray($object, array $callbacks)
14961496
}
14971497
}
14981498

1499+
/**
1500+
* Get the name of the binding the container is currently resolving.
1501+
*
1502+
* @return class-string|string|null
1503+
*/
1504+
public function currentlyResolving()
1505+
{
1506+
return end($this->buildStack) ?: null;
1507+
}
1508+
14991509
/**
15001510
* Get the container's bindings.
15011511
*

0 commit comments

Comments
 (0)
0