@@ -114,7 +114,7 @@ public function __construct(
114114 * @param null|string $name The name of the route.
115115 * @return Router\Route
116116 */
117- public function get ($ path , $ middleware , $ name = null )
117+ public function get ($ path , $ middleware , string $ name = null ): Router \ Route
118118 {
119119 return $ this ->route ($ path , $ middleware , ['GET ' ], $ name );
120120 }
@@ -125,7 +125,7 @@ public function get($path, $middleware, $name = null)
125125 * @param null|string $name The name of the route.
126126 * @return Router\Route
127127 */
128- public function post ($ path , $ middleware , $ name = null )
128+ public function post ($ path , $ middleware , $ name = null ): Router \ Route
129129 {
130130 return $ this ->route ($ path , $ middleware , ['POST ' ], $ name );
131131 }
@@ -136,7 +136,7 @@ public function post($path, $middleware, $name = null)
136136 * @param null|string $name The name of the route.
137137 * @return Router\Route
138138 */
139- public function put ($ path , $ middleware , $ name = null )
139+ public function put ($ path , $ middleware , string $ name = null ): Router \ Route
140140 {
141141 return $ this ->route ($ path , $ middleware , ['PUT ' ], $ name );
142142 }
@@ -147,7 +147,7 @@ public function put($path, $middleware, $name = null)
147147 * @param null|string $name The name of the route.
148148 * @return Router\Route
149149 */
150- public function patch ($ path , $ middleware , $ name = null )
150+ public function patch ($ path , $ middleware , string $ name = null ): Router \ Route
151151 {
152152 return $ this ->route ($ path , $ middleware , ['PATCH ' ], $ name );
153153 }
@@ -158,7 +158,7 @@ public function patch($path, $middleware, $name = null)
158158 * @param null|string $name The name of the route.
159159 * @return Router\Route
160160 */
161- public function delete ($ path , $ middleware , $ name = null )
161+ public function delete ($ path , $ middleware , string $ name = null ): Router \ Route
162162 {
163163 return $ this ->route ($ path , $ middleware , ['DELETE ' ], $ name );
164164 }
@@ -169,7 +169,7 @@ public function delete($path, $middleware, $name = null)
169169 * @param null|string $name The name of the route.
170170 * @return Router\Route
171171 */
172- public function any ($ path , $ middleware , $ name = null )
172+ public function any ($ path , $ middleware , string $ name = null ): Router \ Route
173173 {
174174 return $ this ->route ($ path , $ middleware , null , $ name );
175175 }
@@ -257,7 +257,7 @@ public function pipe($path, $middleware = null) : parent
257257 *
258258 * @return void
259259 */
260- public function pipeRoutingMiddleware ()
260+ public function pipeRoutingMiddleware (): void
261261 {
262262 if ($ this ->routeMiddlewareIsRegistered ) {
263263 return ;
@@ -270,7 +270,7 @@ public function pipeRoutingMiddleware()
270270 *
271271 * @return void
272272 */
273- public function pipeDispatchMiddleware ()
273+ public function pipeDispatchMiddleware (): void
274274 {
275275 if ($ this ->dispatchMiddlewareIsRegistered ) {
276276 return ;
@@ -317,7 +317,7 @@ public function route(string $path, $middleware, array $methods = null, string $
317317 *
318318 * @return Router\Route[]
319319 */
320- public function getRoutes ()
320+ public function getRoutes (): iterable
321321 {
322322 return $ this ->routes ;
323323 }
@@ -339,7 +339,7 @@ public function getRoutes()
339339 * @param null|ResponseInterface $response
340340 * @return void
341341 */
342- public function run (ServerRequestInterface $ request = null , ResponseInterface $ response = null )
342+ public function run (ServerRequestInterface $ request = null , ResponseInterface $ response = null ): void
343343 {
344344 try {
345345 $ request = $ request ?: ServerRequestFactory::fromGlobals ();
@@ -367,7 +367,7 @@ public function run(ServerRequestInterface $request = null, ResponseInterface $r
367367 * @return ContainerInterface
368368 * @throws Exception\ContainerNotRegisteredException
369369 */
370- public function getContainer ()
370+ public function getContainer (): ContainerInterface
371371 {
372372 if (null === $ this ->container ) {
373373 throw new Exception \ContainerNotRegisteredException ();
@@ -387,7 +387,7 @@ public function getContainer()
387387 *
388388 * @return RequestHandlerInterface
389389 */
390- public function getDefaultDelegate ()
390+ public function getDefaultDelegate (): RequestHandlerInterface
391391 {
392392 if ($ this ->defaultDelegate ) {
393393 return $ this ->defaultDelegate ;
@@ -416,7 +416,7 @@ public function getDefaultDelegate()
416416 *
417417 * @return EmitterInterface
418418 */
419- public function getEmitter ()
419+ public function getEmitter (): EmitterInterface
420420 {
421421 if (! $ this ->emitter ) {
422422 $ this ->emitter = new Emitter \EmitterStack ();
@@ -436,7 +436,7 @@ public function getEmitter()
436436 * @param null|array $methods
437437 * @throws Exception\DuplicateRouteException on duplicate route detection.
438438 */
439- private function checkForDuplicateRoute ($ path , $ methods = null )
439+ private function checkForDuplicateRoute (string $ path , array $ methods = null ): void
440440 {
441441 if (null === $ methods ) {
442442 $ methods = Router \Route::HTTP_METHOD_ANY ;
@@ -467,7 +467,7 @@ private function checkForDuplicateRoute($path, $methods = null)
467467 * @param Throwable $exception
468468 * @return void
469469 */
470- private function emitMarshalServerRequestException (Throwable $ exception )
470+ private function emitMarshalServerRequestException (Throwable $ exception ): void
471471 {
472472 if ($ this ->container && $ this ->container ->has (Middleware \ErrorResponseGenerator::class)) {
473473 $ generator = $ this ->container ->get (Middleware \ErrorResponseGenerator::class);
0 commit comments