Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 802c4f9

Browse files
committed
Noted deprecated methods
All methods are deprecated starting in 1.1, to be removed in version 2.0. These include: - pipeErrorHandler - routeMiddleware - dispatchMiddleware - getFinalHandler This patch also provides the method `getDefaultDelegate()`, which is used in version 2.0, to allow consumers of `getFinalHandler()` to update their code prior to migrating.
1 parent f0d7feb commit 802c4f9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/Application.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,13 @@ public function pipe($path, $middleware = null)
335335
* Once middleware detection and wrapping (if necessary) is complete,
336336
* proxies to pipe().
337337
*
338+
* @deprecated since 1.1.0; to remove in 2.0.0. Stratigility v1-style
339+
* "error middleware" (middleware with four arguments, the first of which
340+
* being an error) was deprecated in Stratigility 1.3, and support
341+
* removed in Stratigility 2.0. You can start using standard middleware
342+
* for error handling by calling `raiseThrowables()` on the `Application`
343+
* instance, and piping such middleware in an outer layer of your application.
344+
* For an example, see `Zend\Stratigility\Middleware\ErrorHandler`.
338345
* @param string|callable $path Either a URI path prefix, or middleware.
339346
* @param null|string|callable $middleware Middleware
340347
* @return self
@@ -410,6 +417,11 @@ public function pipeRouteResultObserverMiddleware()
410417
* Allow header, and `$next()` is called with its `$error` argument set
411418
* to the value `405` (invoking the next error middleware).
412419
*
420+
* @deprecated since 1.1.0; to remove in 2.0.0. This method is extracted to
421+
* its own dedicated middleware class starting in 2.0.0. If you are
422+
* manually piping this method into your application or middleware
423+
* pipelines, or overriding the method, you will need to update your
424+
* code when migrating to 2.0.
413425
* @param ServerRequestInterface $request
414426
* @param ResponseInterface $response
415427
* @param callable $next
@@ -453,6 +465,11 @@ public function routeMiddleware(ServerRequestInterface $request, ResponseInterfa
453465
* Finally, it attempts to marshal the middleware, and dispatches it when
454466
* complete, return the response.
455467
*
468+
* @deprecated since 1.1.0; to remove in 2.0.0. This method is extracted to
469+
* its own dedicated middleware class starting in 2.0.0. If you are
470+
* manually piping this method into your application or middleware
471+
* pipelines, or overriding the method, you will need to update your
472+
* code when migrating to 2.0.
456473
* @param ServerRequestInterface $request
457474
* @param ResponseInterface $response
458475
* @param callable $next
@@ -598,6 +615,9 @@ public function getContainer()
598615
/**
599616
* Return the final handler to use during `run()` if the stack is exhausted.
600617
*
618+
* @deprecated since 1.1.0; renamed to `getDefaultDelegate()` in version
619+
* 2.0.0. If you are consuming this method, please update your code to call
620+
* getDefaultDelegate() instead.
601621
* @param null|ResponseInterface $response Response instance with which to seed the
602622
* FinalHandler; used to determine if the response passed to the handler
603623
* represents the original or final response state.
@@ -618,6 +638,20 @@ public function getFinalHandler(ResponseInterface $response = null)
618638
return $this->finalHandler;
619639
}
620640

641+
/**
642+
* Return the default delegate to use during `run()` when the stack is exhausted.
643+
*
644+
* Provided as a forwards compatibility measure with version 2, and proxies
645+
* to getFinalHandler(); please note that it does not accept any arguments,
646+
* nor pass them on to that method.
647+
*
648+
* @return callable|null
649+
*/
650+
public function getDefaultDelegate()
651+
{
652+
return $this->getFinalHandler();
653+
}
654+
621655
/**
622656
* Retrieve an emitter to use during run().
623657
*

0 commit comments

Comments
 (0)