99use function is_callable ;
1010use function is_int ;
1111use function is_string ;
12- use Psr \Container \ContainerExceptionInterface ;
1312use Psr \Container \ContainerInterface ;
14- use Psr \ Container \NotFoundExceptionInterface ;
15- use RuntimeException ;
13+ use WebProject \ PhpOpenApiMockServer \ Container \Exception \ ContainerException ;
14+ use WebProject \ PhpOpenApiMockServer \ Container \ Exception \ NotFoundException ;
1615
1716/**
1817 * Lightweight PSR-11 container that supports the Mezzio ConfigProvider format
@@ -41,7 +40,7 @@ public function get(string $id): mixed
4140 }
4241
4342 if (!isset ($ this ->factories [$ resolved ])) {
44- throw new class ("Service ' {$ id }' not found in container. " ) extends RuntimeException implements NotFoundExceptionInterface {} ;
43+ throw new NotFoundException ("Service ' {$ id }' not found in container. " );
4544 }
4645
4746 $ factory = $ this ->factories [$ resolved ];
@@ -51,7 +50,7 @@ public function get(string $id): mixed
5150 }
5251
5352 if (!is_callable ($ factory )) {
54- throw new class ("Factory for ' {$ resolved }' is not callable. " ) extends RuntimeException implements ContainerExceptionInterface {} ;
53+ throw new ContainerException ("Factory for ' {$ resolved }' is not callable. " );
5554 }
5655
5756 $ instance = $ factory ($ this , $ resolved );
@@ -65,7 +64,7 @@ public function get(string $id): mixed
6564 }
6665
6766 if (!is_callable ($ delegator )) {
68- throw new class ("Delegator for ' {$ resolved }' is not callable. " ) extends RuntimeException implements ContainerExceptionInterface {} ;
67+ throw new ContainerException ("Delegator for ' {$ resolved }' is not callable. " );
6968 }
7069
7170 $ instance = $ delegator ($ this , $ resolved , static fn (): mixed => $ current );
@@ -149,7 +148,7 @@ private function resolveAlias(string $id): string
149148
150149 while (isset ($ this ->aliases [$ id ])) {
151150 if (isset ($ seen [$ id ])) {
152- throw new RuntimeException ("Circular alias detected for ' {$ id }'. " );
151+ throw new ContainerException ("Circular alias detected for ' {$ id }'. " );
153152 }
154153
155154 $ seen [$ id ] = true ;
0 commit comments