File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212
1313return static function (Application $ application , MiddlewareFactory $ middlewareFactory ): void {
1414 $ specPath = getenv ('OPENAPI_SPEC ' ) ?: null ;
15- $ packageRoot = dirname (__DIR__ ) ?: ' /app ' ;
15+ $ packageRoot = dirname (__DIR__ );
1616
1717 if (null === $ specPath ) {
1818 $ specPath = $ packageRoot . '/data/openapi.yaml ' ;
Original file line number Diff line number Diff line change @@ -159,22 +159,25 @@ public function configure(array $config): void
159159
160160 public function setService (string $ name , mixed $ service ): void
161161 {
162+ unset($ this ->aliases [$ name ], $ this ->factories [$ name ]);
162163 $ this ->services [$ name ] = $ service ;
163164 }
164165
165166 public function setFactory (string $ name , callable |string $ factory ): void
166167 {
168+ unset($ this ->aliases [$ name ], $ this ->services [$ name ]);
167169 $ this ->factories [$ name ] = $ factory ;
168170 }
169171
170172 public function setAlias (string $ alias , string $ target ): void
171173 {
174+ unset($ this ->services [$ alias ], $ this ->factories [$ alias ]);
172175 $ this ->aliases [$ alias ] = $ target ;
173176 }
174177
175178 public function setInvokableClass (string $ name , string $ class ): void
176179 {
177- $ this ->factories [ $ name] = static fn (): object => new $ class ();
180+ $ this ->setFactory ( $ name, static fn (): object => new $ class () );
178181 }
179182
180183 private function resolveAlias (string $ id , bool $ throwOnCircular = true ): ?string
You can’t perform that action at this time.
0 commit comments