-
Notifications
You must be signed in to change notification settings - Fork 90
Upgrade to programmatic pipeline and the new error handler #119
Upgrade to programmatic pipeline and the new error handler #119
Conversation
@weierophinney I've started with updating the skeleton to zend-expressive 1.3 and programmatic configuration, It seems to work. |
- Remove useless tests for PHP lowest dependencies. Composer always creates the project with the latest dependencies, so there is no need to test the lowest dependencies. - Remove deprecated --install option for composer - Rename $CHECK_CS to $EXECUTE_CS_CHECK as in the latest stratigility package
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.
Looks good! A few minor changes requested, mainly around importing classes and/or namespaces into some of the generated files to make them more readable. The bigger question I have is around what prompted the removal of the lowest/locked/latest testing strategy.
- DEPS=latest | ||
- php: 5.6 | ||
env: | ||
- DEPS=lowest |
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.
What's prompting removal of the lowest/latest/locked strategy?
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.
If I remember correctly there are dependency issues when the composer.lock file is committed. Or at least there were warnings. That explains the missing locked strategy.
I even have my doubts if "lowest" is useful. When creating a new project always the latest versions are installed.
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.
Seems that I've removed the "lowest". I'll revert that one.
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.
Also do we need hhvm builds? They fail anyway.
@@ -79,7 +79,7 @@ scripts** with `--no-scripts`, otherwise it will remove the installer and all | |||
tests. | |||
|
|||
```bash | |||
$ composer install --no-scripts | |||
$ composer update --no-scripts |
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 update
and not install
? Don't we want developers to use the same set of deps we've tested against?
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.
Since there is no composer.lock file it doesn't really matter if install or update is used. Just in case there is a leftover composer.lock file for whatever reason, I prefer update
so it does the same in all situations.
EDIT: Thinking about this, we definitely want update
so the local composer.lock
is ignored and always the latest dependencies are used.
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.
👍
"roave/security-advisories": "dev-master", | ||
"zendframework/zend-expressive": "^1.0", | ||
"zendframework/zend-expressive": "^1.1.x-dev || ^1.1", |
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.
the 1.1.x-dev constrating should probably read ^1.1.x-dev@dev
. Additionally, since ||
returns the first that matches, switch the order of the two to ensure the stable release is selected once available.
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.
OH!!! I've got Travis powers :D
PHP 7 build was still failing. After removing the cache and restarting the build it was successful.
Zend\Expressive\Container\ErrorResponseGeneratorFactory::class, | ||
|
||
Zend\Expressive\Middleware\NotFoundHandler::class => | ||
Zend\Expressive\Container\NotFoundHandlerFactory::class, |
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.
Let's import these classes, or, at the least, the Middleware
and Container
subnamespaces; that'll make these shorter and more readable.
// The handlers in each middleware attached this way will see a URI with that PATH SEGMENT STRIPPED !!! | ||
// - $app->pipe('/api', $apiMiddleware); | ||
// - $app->pipe('/docs', $apiDocMiddleware); | ||
// - $app->pipe('/files', $filesMiddleware); |
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.
This bit should be above the pipeRoutingMiddleware()
call, as segregated middleware will usually have its own routing.
} | ||
|
||
if (!$this->template) { | ||
return new JsonResponse([ | ||
'welcome' => 'Congratulations! You have installed the zend-expressive skeleton application.', | ||
'docsUrl' => 'zend-expressive.readthedocs.org', | ||
'docsUrl' => 'https://docs.zendframework.com/zend-expressive/', |
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.
Nice catch on all of these documentation links!
// 'middleware' => App\Action\HomePageAction::class, | ||
// 'allowed_methods' => ['GET'], | ||
// ], | ||
], |
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.
I find the changes in the various router configuration files interesting, as I noticed earlier when drafting the information on how to handle module-specific routing that the routes do not change between implementations unless there are dynamic segments in play. None of the default routes have those! (In other words: nice work!)
* $app->post('path', MiddlewareAction::class, 'route.name'); | ||
* $app->put('path', MiddlewareAction::class, 'route.name'); | ||
* $app->patch('path', MiddlewareAction::class, 'route.name'); | ||
* $app->delete('path', MiddlewareAction::class, 'route.name'); |
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.
I'd likely give some concrete examples here, instead of using the same path, class, and name for each, to make it more clear that each middleware handles a specific HTTP method/path combination.
@@ -15,7 +15,7 @@ | |||
<div class="row"> | |||
<div class="col-md-4"> | |||
<h2> | |||
<a href="https://zendframework.github.io/zend-expressive/getting-started/features/" target="_blank"> | |||
<a href="https://docs.zendframework.com/zend-expressive/getting-started/features/" target="_blank"> |
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.
Thanks for fixing these documentation URIs!
@@ -78,7 +79,7 @@ public function testRouter( | |||
$expectedRouter, | |||
$config['dependencies']['invokables'][Router\RouterInterface::class] | |||
); | |||
$this->assertEquals($expectedRoutes, $config['routes']); | |||
//$this->assertEquals($expectedRoutes, $config['routes']); |
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 is this commented out, instead of removed outright?
"since || returns the first that matches, switch the order of the two to ensure the stable release is selected once available" - @weierophinney
Without the `--no-scripts` flag the installer starts and it removes itself and there is nothing left to contribute to.
At least version 2.3.1 is required for `Generic.Arrays.DisallowLongArraySyntax`.
Upgrade to programmatic pipeline and the new error handler
Thanks, @xtreamwayz! |
This PR adds support for zendframework/zend-expressive#396.
TODO after zend-expressive 1.1 is released: