@@ -261,7 +261,8 @@ protected function getClosure($abstract, $concrete)
261261 return $ container ->build ($ concrete );
262262 }
263263
264- return $ container ->make ($ concrete , $ parameters );
264+ // To prevent extra call to resolving callbacks, we make the object silently.
265+ return $ container ->resolve ($ concrete , $ parameters , true );
265266 };
266267 }
267268
@@ -630,9 +631,10 @@ public function get($id)
630631 *
631632 * @param string $abstract
632633 * @param array $parameters
634+ * @param bool $silent
633635 * @return mixed
634636 */
635- protected function resolve ($ abstract , $ parameters = [])
637+ protected function resolve ($ abstract , $ parameters = [], $ silent = false )
636638 {
637639 $ abstract = $ this ->getAlias ($ abstract );
638640
@@ -674,8 +676,9 @@ protected function resolve($abstract, $parameters = [])
674676 $ this ->instances [$ abstract ] = $ object ;
675677 }
676678
677- $ this ->fireResolvingCallbacks ($ abstract , $ object );
678-
679+ if (! $ silent ) {
680+ $ this ->fireResolvingCallbacks ($ abstract , $ object );
681+ }
679682 // Before returning, we will also set the resolved flag to "true" and pop off
680683 // the parameter overrides for this build. After those two things are done
681684 // we will be ready to return back the fully constructed class instance.
0 commit comments