File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11<?php
22
3+ declare (strict_types=1 );
4+
35namespace Webdevcave \Yadic ;
46
57use Closure ;
@@ -49,14 +51,15 @@ public function __construct(CacheInterface $cache = null)
4951 *
5052 * @template T
5153 *
52- * @param T $id Identifier of the entry to look for.
54+ * @param T $id Identifier of the entry to look for.
55+ * @param array $arguments Predefined arguments.
5356 *
5457 * @throws NotFoundExceptionInterface No entry was found for **this** identifier.
5558 * @throws ContainerExceptionInterface Error while retrieving the entry.
5659 *
5760 * @return T
5861 */
59- public function get (string $ id ): mixed
62+ public function get (string $ id, array $ arguments = [] ): mixed
6063 {
6164 if (isset ($ this ->singletons [$ id ])) {
6265 return $ this ->singletons [$ id ];
@@ -69,10 +72,9 @@ public function get(string $id): mixed
6972 try {
7073 $ className = $ this ->aliases [$ id ] ?? $ id ;
7174 $ reflectionClass = new ReflectionClass ($ className );
72- $ arguments = [];
7375
7476 if ($ constructor = $ reflectionClass ->getConstructor ()) {
75- $ arguments = $ this ->createArguments ($ constructor );
77+ $ arguments = $ this ->createArguments ($ constructor, $ arguments );
7678 }
7779
7880 $ instance = $ reflectionClass ->newInstanceArgs ($ arguments );
You can’t perform that action at this time.
0 commit comments