diff --git a/src/Dispatching/DispatchStack.php b/src/Dispatching/DispatchStack.php index 6bf2cd5..c841d0f 100644 --- a/src/Dispatching/DispatchStack.php +++ b/src/Dispatching/DispatchStack.php @@ -44,7 +44,7 @@ class DispatchStack implements DispatchStackInterface * * When the stack is dispatched empty, or when all middleware in the stack * call the $next argument they were passed, this method will call the - * $next it receieved. + * $next it received. * * When any middleware in the stack returns a response without calling its * $next, the stack will not call the $next it received. diff --git a/src/Dispatching/DispatchStackInterface.php b/src/Dispatching/DispatchStackInterface.php index 953281c..6cffda5 100644 --- a/src/Dispatching/DispatchStackInterface.php +++ b/src/Dispatching/DispatchStackInterface.php @@ -32,16 +32,16 @@ interface DispatchStackInterface extends MiddlewareInterface * returns the response unchanged. * * When any middleware returns a response without calling the $next - * argument it recieved, the stack instance MUST stop propogating and MUST + * argument it received, the stack instance MUST stop propagating and MUST * return a response without calling the $next argument passed to __invoke. * * This method MUST call the passed $next argument when: * - The stack is empty (i.e., there is no middleware to dispatch) - * - Each middleware called the $next that it receieved. + * - Each middleware called the $next that it received. * * This method MUST NOT call the passed $next argument when the stack is * not empty and any middleware returns a response without calling the - * $next it receieved. + * $next it received. * * @param ServerRequestInterface $request * @param ResponseInterface $response diff --git a/src/Dispatching/DispatcherInterface.php b/src/Dispatching/DispatcherInterface.php index f1fe1f7..28bd113 100644 --- a/src/Dispatching/DispatcherInterface.php +++ b/src/Dispatching/DispatcherInterface.php @@ -29,7 +29,7 @@ interface DispatcherInterface * * Implementation MAY dispatch other types of middleware. * - * When an implementation receives a $middware that is not of a type it can + * When an implementation receives a $middleware that is not of a type it can * dispatch, it MUST throw a DispatchException. * * @param mixed $middleware diff --git a/src/MiddlewareInterface.php b/src/MiddlewareInterface.php index b56407b..4f700be 100644 --- a/src/MiddlewareInterface.php +++ b/src/MiddlewareInterface.php @@ -17,17 +17,18 @@ interface MiddlewareInterface * $next is a callable that expects a request and response as parameters * and returns a response. Calling $next forwards a request and response * to the next middleware in the sequence (if any) and continues - * propagation; returning a response without calling $next halts propgation - * and prevents subsequent middleware from running. + * propagation; returning a response without calling $next halts + * propagation and prevents subsequent middleware from running. * - * Implementations MAY call $next to continue propagation. After calling - * $next, implementations MUST return the response returned by $next or - * use $next's returned response to determine the response it will - * ulitimately return. Implementations MUST NOT call $next and disregard - * $next's returned response. + * Implementations SHOULD call $next to allow subsequent middleware to act + * on the request and response. Implementations MAY further alter the + * response returned by $next before returning it. * - * Implementaitons MAY return a response without calling $next to halt - * propagation. + * Implementations MAY return a response without calling $next to prevent + * propagation (e.g., for error conditions). + * + * Implementations SHOULD NOT call $next and disregard the response by + * returning an entirely unrelated response. * * @param ServerRequestInterface $request * @param ResponseInterface $response diff --git a/src/Transmission/Transmitter.php b/src/Transmission/Transmitter.php index 6666257..b9b47af 100644 --- a/src/Transmission/Transmitter.php +++ b/src/Transmission/Transmitter.php @@ -28,7 +28,7 @@ class Transmitter implements TransmitterInterface * * This method will also provide a Content-length header if: * - Response does not have a Content-length header - * - Response does not have a Tranfser-encoding: chunked header + * - Response does not have a Transfer-encoding: chunked header * - Response body stream is readable and reports a non-null size * * @param ServerRequestInterface $request @@ -69,7 +69,7 @@ class Transmitter implements TransmitterInterface // Add a Content-length header to the response when all of these are true: // // - Response does not have a Content-length header - // - Response does not have a Tranfser-encoding: chunked header + // - Response does not have a Transfer-encoding: chunked header // - Response body stream is readable and reports a non-null size // if (!$response->hasHeader("Content-length")