This repository was archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
Modify middleware listener to use stratigility pipe #217
Merged
weierophinney
merged 23 commits into
zendframework:develop
from
asgrim:modify-middleware-listener-to-use-stratigility-pipe
May 1, 2017
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2c64d2e
Merge branch 'hotfix/232'
weierophinney 2712a99
Require stratigility in dev, and suggestion
asgrim cab17a2
Added tests for handling an array of middleware to be piped
asgrim 24201cb
Added implementation of Stratigility middleware pipe
asgrim ab63639
Updated RotueMatch#getParams calls to be expected in tests
asgrim 81c5f2e
Extract logic to create middleware pipe into private method
asgrim 6f9c271
Do not allow a null middleware
asgrim 7e89d6a
Remove null coalesce operator because still need to support PHP 5.6
asgrim cebe041
Added support for HttpInterop style middlewares
asgrim d0debca
Refactored ReachedFinalHandlerException to use named constructor
asgrim 6073ca2
Fixed typo in phpdoc for MvcEvent
asgrim b05cd8b
Switch MiddlewareNotCallableExceptionTest assertions to be invoked on…
asgrim 7d89900
Fixed incorrectly rebased composer dependencies
asgrim 4c393f1
Use namespaced PHPUnit import
asgrim 03ffda0
Use expectException instead of deprecated setExpectedException
asgrim 4116803
Fixes @return DefaultRenderingStrategy typo at HttpDefaultRenderingSt…
samsonasik 4dbdb4b
Use mocks instead of anon classes for middlewares
asgrim 2a4a644
Merge pull request #237 from samsonasik/@return-rendering-strategy
weierophinney 7e5c560
Added CHANGELOG for #237
weierophinney 00bdd8c
Merge branch 'hotfix/237' into develop
weierophinney bf741df
Merge pull request #217 from asgrim/modify-middleware-listener-to-use…
weierophinney 6d09019
Rename MiddlewareNotCallableException to InvalidMiddlewareException
weierophinney 6a4bf9f
Use http-interop process()
weierophinney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Mvc\Exception; | ||
|
||
final class InvalidMiddlewareException extends RuntimeException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $middlewareName; | ||
|
||
/** | ||
* @param string $middlewareName | ||
* @return self | ||
*/ | ||
public static function fromMiddlewareName($middlewareName) | ||
{ | ||
$middlewareName = (string)$middlewareName; | ||
$instance = new self(sprintf('Cannot dispatch middleware %s', $middlewareName)); | ||
$instance->middlewareName = $middlewareName; | ||
return $instance; | ||
} | ||
|
||
public static function fromNull() | ||
{ | ||
$instance = new self('Middleware name cannot be null'); | ||
return $instance; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function toMiddlewareName() | ||
{ | ||
return null !== $this->middlewareName ? $this->middlewareName : ''; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Mvc\Exception; | ||
|
||
class ReachedFinalHandlerException extends RuntimeException | ||
{ | ||
/** | ||
* @return self | ||
*/ | ||
public static function create() | ||
{ | ||
return new self('Reached the final handler for middleware pipe - check the pipe configuration'); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these lines removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is potentially no longer just "one" middleware name... how do we decide which is the failed one? First? Last? IIRC I don't think there's any way (outside of the exception bubble here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right - that makes sense, then.