@@ -94,7 +94,7 @@ public function callable(string $class): callable
9494 // Check `$handler` references a class name that is callable, i.e. has an `__invoke()` method.
9595 // This initial version is intentionally limited to checking the method name only.
9696 // A follow-up version will likely use reflection to check request handler argument types.
97- if (!is_callable ($ handler )) {
97+ if (!\ is_callable ($ handler )) {
9898 throw new \Error (
9999 'Request handler ' . \explode ("\0" , $ class )[0 ] . ' has no public __invoke() method '
100100 );
@@ -115,7 +115,7 @@ public function callable(string $class): callable
115115 */
116116 public function getEnv (string $ name ): ?string
117117 {
118- assert (\preg_match ('/^[A-Z][A-Z0-9_]+$/ ' , $ name ) === 1 );
118+ \ assert (\preg_match ('/^[A-Z][A-Z0-9_]+$/ ' , $ name ) === 1 );
119119
120120 if ($ this ->container instanceof ContainerInterface && $ this ->container ->has ($ name )) {
121121 $ value = $ this ->container ->get ($ name );
@@ -180,7 +180,7 @@ public function getErrorHandler(): ErrorHandler
180180 */
181181 private function loadObject (string $ name , int $ depth = 64 ) /*: object (PHP 7.2+) */
182182 {
183- assert (\is_array ($ this ->container ));
183+ \ assert (\is_array ($ this ->container ));
184184
185185 if (\array_key_exists ($ name , $ this ->container )) {
186186 if (\is_string ($ this ->container [$ name ])) {
@@ -226,13 +226,13 @@ private function loadObject(string $name, int $depth = 64) /*: object (PHP 7.2+)
226226 );
227227 }
228228
229- assert ($ this ->container [$ name ] instanceof $ name );
229+ \ assert ($ this ->container [$ name ] instanceof $ name );
230230
231231 return $ this ->container [$ name ];
232232 }
233233
234234 // Check `$name` references a valid class name that can be autoloaded
235- if (!\class_exists ($ name , true ) && !interface_exists ($ name , false ) && !trait_exists ($ name , false )) {
235+ if (!\class_exists ($ name , true ) && !\ interface_exists ($ name , false ) && !\ trait_exists ($ name , false )) {
236236 throw new \Error ('Class ' . $ name . ' not found ' );
237237 }
238238
@@ -287,7 +287,7 @@ private function loadParameter(\ReflectionParameter $parameter, int $depth, bool
287287 throw new \Error (self ::parameterError ($ parameter , $ for ) . ' is recursive ' );
288288 }
289289
290- assert (\is_array ($ this ->container ));
290+ \ assert (\is_array ($ this ->container ));
291291 $ type = $ parameter ->getType ();
292292
293293 // abort for union types (PHP 8.0+) and intersection types (PHP 8.1+)
@@ -306,7 +306,7 @@ private function loadParameter(\ReflectionParameter $parameter, int $depth, bool
306306 } // @codeCoverageIgnoreEnd
307307
308308 // load container variables if parameter name is known
309- assert ($ type === null || $ type instanceof \ReflectionNamedType);
309+ \ assert ($ type === null || $ type instanceof \ReflectionNamedType);
310310 if ($ allowVariables && $ this ->hasVariable ($ parameter ->getName ())) {
311311 $ value = $ this ->loadVariable ($ parameter ->getName (), $ depth );
312312
@@ -355,13 +355,13 @@ private function hasVariable(string $name): bool
355355 */
356356 private function loadVariable (string $ name , int $ depth = 64 ) /*: object|string|int|float|bool|null (PHP 8.0+) */
357357 {
358- assert ($ this ->hasVariable ($ name ));
359- assert (\is_array ($ this ->container ) || !$ this ->container ->has ($ name ));
358+ \ assert ($ this ->hasVariable ($ name ));
359+ \ assert (\is_array ($ this ->container ) || !$ this ->container ->has ($ name ));
360360
361361 if (\is_array ($ this ->container ) && ($ this ->container [$ name ] ?? null ) instanceof \Closure) {
362362 // build list of factory parameters based on parameter types
363363 $ factory = $ this ->container [$ name ];
364- assert ($ factory instanceof \Closure);
364+ \ assert ($ factory instanceof \Closure);
365365 $ closure = new \ReflectionFunction ($ factory );
366366 $ params = $ this ->loadFunctionParams ($ closure , $ depth - 1 , true , '$ ' . $ name );
367367
@@ -378,17 +378,17 @@ private function loadVariable(string $name, int $depth = 64) /*: object|string|i
378378 } elseif (\is_array ($ this ->container ) && \array_key_exists ($ name , $ this ->container )) {
379379 $ value = $ this ->container [$ name ];
380380 } elseif (isset ($ _ENV [$ name ])) {
381- assert (\is_string ($ _ENV [$ name ]));
381+ \ assert (\is_string ($ _ENV [$ name ]));
382382 $ value = $ _ENV [$ name ];
383383 } elseif (isset ($ _SERVER [$ name ])) {
384- assert (\is_string ($ _SERVER [$ name ]));
384+ \ assert (\is_string ($ _SERVER [$ name ]));
385385 $ value = $ _SERVER [$ name ];
386386 } else {
387387 $ value = \getenv ($ name );
388- assert ($ this ->useProcessEnv && $ value !== false );
388+ \ assert ($ this ->useProcessEnv && $ value !== false );
389389 }
390390
391- assert (\is_object ($ value ) || \is_scalar ($ value ) || $ value === null );
391+ \ assert (\is_object ($ value ) || \is_scalar ($ value ) || $ value === null );
392392 return $ value ;
393393 }
394394
0 commit comments