@@ -81,12 +81,9 @@ class Application extends MiddlewarePipe
8181 private $ responsePrototype ;
8282
8383 /**
84- * Constructor
85- *
8684 * Calls on the parent constructor, and then uses the provided arguments
8785 * to set internal properties.
8886 *
89- * @param Router\RouterInterface $router
9087 * @param null|ContainerInterface $container IoC container from which to pull services, if any.
9188 * @param null|RequestHandlerInterface $defaultDelegate Default delegate
9289 * to use when $out is not provided on invocation / run() is invoked.
@@ -109,67 +106,55 @@ public function __construct(
109106 }
110107
111108 /**
112- * @param string|Router\Route $path
113109 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
114110 * @param null|string $name The name of the route.
115- * @return Router\Route
116111 */
117- public function get ($ path , $ middleware , $ name = null )
112+ public function get ($ path , $ middleware , string $ name = null ) : Router \ Route
118113 {
119114 return $ this ->route ($ path , $ middleware , ['GET ' ], $ name );
120115 }
121116
122117 /**
123- * @param string|Router\Route $path
124118 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
125119 * @param null|string $name The name of the route.
126- * @return Router\Route
127120 */
128- public function post ($ path , $ middleware , $ name = null )
121+ public function post ($ path , $ middleware , $ name = null ) : Router \ Route
129122 {
130123 return $ this ->route ($ path , $ middleware , ['POST ' ], $ name );
131124 }
132125
133126 /**
134- * @param string|Router\Route $path
135127 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
136128 * @param null|string $name The name of the route.
137- * @return Router\Route
138129 */
139- public function put ($ path , $ middleware , $ name = null )
130+ public function put ($ path , $ middleware , string $ name = null ) : Router \ Route
140131 {
141132 return $ this ->route ($ path , $ middleware , ['PUT ' ], $ name );
142133 }
143134
144135 /**
145- * @param string|Router\Route $path
146136 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
147137 * @param null|string $name The name of the route.
148- * @return Router\Route
149138 */
150- public function patch ($ path , $ middleware , $ name = null )
139+ public function patch ($ path , $ middleware , string $ name = null ) : Router \ Route
151140 {
152141 return $ this ->route ($ path , $ middleware , ['PATCH ' ], $ name );
153142 }
154143
155144 /**
156- * @param string|Router\Route $path
157145 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
158146 * @param null|string $name The name of the route.
159- * @return Router\Route
160147 */
161- public function delete ($ path , $ middleware , $ name = null )
148+ public function delete ($ path , $ middleware , string $ name = null ) : Router \ Route
162149 {
163150 return $ this ->route ($ path , $ middleware , ['DELETE ' ], $ name );
164151 }
165152
166153 /**
167- * @param string|Router\Route $path
168154 * @param callable|string $middleware Middleware (or middleware service name) to associate with route.
169155 * @param null|string $name The name of the route.
170- * @return Router\Route
171156 */
172- public function any ($ path , $ middleware , $ name = null )
157+ public function any ($ path , $ middleware , string $ name = null ) : Router \ Route
173158 {
174159 return $ this ->route ($ path , $ middleware , null , $ name );
175160 }
@@ -206,7 +191,6 @@ public function any($path, $middleware, $name = null)
206191 *
207192 * @param string|array|callable $path Either a URI path prefix, or middleware.
208193 * @param null|string|array|callable $middleware Middleware
209- * @return self
210194 */
211195 public function pipe ($ path , $ middleware = null ) : parent
212196 {
@@ -254,10 +238,8 @@ public function pipe($path, $middleware = null) : parent
254238
255239 /**
256240 * Register the routing middleware in the middleware pipeline.
257- *
258- * @return void
259241 */
260- public function pipeRoutingMiddleware ()
242+ public function pipeRoutingMiddleware () : void
261243 {
262244 if ($ this ->routeMiddlewareIsRegistered ) {
263245 return ;
@@ -267,10 +249,8 @@ public function pipeRoutingMiddleware()
267249
268250 /**
269251 * Register the dispatch middleware in the middleware pipeline.
270- *
271- * @return void
272252 */
273- public function pipeDispatchMiddleware ()
253+ public function pipeDispatchMiddleware () : void
274254 {
275255 if ($ this ->dispatchMiddlewareIsRegistered ) {
276256 return ;
@@ -317,7 +297,7 @@ public function route(string $path, $middleware, array $methods = null, string $
317297 *
318298 * @return Router\Route[]
319299 */
320- public function getRoutes ()
300+ public function getRoutes () : iterable
321301 {
322302 return $ this ->routes ;
323303 }
@@ -334,12 +314,8 @@ public function getRoutes()
334314 *
335315 * Once it has processed itself, it emits the returned response using the
336316 * composed emitter.
337- *
338- * @param null|ServerRequestInterface $request
339- * @param null|ResponseInterface $response
340- * @return void
341317 */
342- public function run (ServerRequestInterface $ request = null , ResponseInterface $ response = null )
318+ public function run (ServerRequestInterface $ request = null , ResponseInterface $ response = null ) : void
343319 {
344320 try {
345321 $ request = $ request ?: ServerRequestFactory::fromGlobals ();
@@ -364,10 +340,9 @@ public function run(ServerRequestInterface $request = null, ResponseInterface $r
364340 *
365341 * If no IoC container is registered, we raise an exception.
366342 *
367- * @return ContainerInterface
368343 * @throws Exception\ContainerNotRegisteredException
369344 */
370- public function getContainer ()
345+ public function getContainer () : ContainerInterface
371346 {
372347 if (null === $ this ->container ) {
373348 throw new Exception \ContainerNotRegisteredException ();
@@ -384,10 +359,8 @@ public function getContainer()
384359 * service, pulls that service, assigns it, and returns it.
385360 * - If no container is composed, creates an instance of Delegate\NotFoundDelegate
386361 * using the current response prototype only (i.e., no templating).
387- *
388- * @return RequestHandlerInterface
389362 */
390- public function getDefaultDelegate ()
363+ public function getDefaultDelegate () : RequestHandlerInterface
391364 {
392365 if ($ this ->defaultDelegate ) {
393366 return $ this ->defaultDelegate ;
@@ -413,10 +386,8 @@ public function getDefaultDelegate()
413386 *
414387 * If none was registered during instantiation, this will lazy-load an
415388 * EmitterStack composing an SapiEmitter instance.
416- *
417- * @return EmitterInterface
418389 */
419- public function getEmitter ()
390+ public function getEmitter () : EmitterInterface
420391 {
421392 if (! $ this ->emitter ) {
422393 $ this ->emitter = new Emitter \EmitterStack ();
@@ -432,11 +403,9 @@ public function getEmitter()
432403 * if so, and it responds to any of the $methods indicated, raises
433404 * a DuplicateRouteException indicating a duplicate route.
434405 *
435- * @param string $path
436- * @param null|array $methods
437406 * @throws Exception\DuplicateRouteException on duplicate route detection.
438407 */
439- private function checkForDuplicateRoute ($ path , $ methods = null )
408+ private function checkForDuplicateRoute (string $ path , array $ methods = null ) : void
440409 {
441410 if (null === $ methods ) {
442411 $ methods = Router \Route::HTTP_METHOD_ANY ;
@@ -463,11 +432,7 @@ private function checkForDuplicateRoute($path, $methods = null)
463432 }
464433 }
465434
466- /**
467- * @param Throwable $exception
468- * @return void
469- */
470- private function emitMarshalServerRequestException (Throwable $ exception )
435+ private function emitMarshalServerRequestException (Throwable $ exception ) : void
471436 {
472437 if ($ this ->container && $ this ->container ->has (Middleware \ErrorResponseGenerator::class)) {
473438 $ generator = $ this ->container ->get (Middleware \ErrorResponseGenerator::class);
0 commit comments