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

Conversation

weierophinney
Copy link
Member

Because the MiddlewarePipe does not compose a "default handler", and because the MiddlewarePipe is what the request handler runner dispatches, there is no longer a concept of a "default delegate" (v2) or "default handler" (v3); there is only middleware.

As such, this patch merges the NotFoundHandler into the NotFoundMiddleware.

A key is kept for the DefaultDelegate service, but it will now resolve to the NotFoundMiddleware.

Fixes #441.

@weierophinney weierophinney added this to the 3.0.0alpha3 milestone Feb 6, 2018
weierophinney added a commit to weierophinney/zend-expressive that referenced this pull request Feb 6, 2018
Removes the zendframework#543 entry indicating the changed `NotFoundDelegate`,
instead adding a "Removed" entry for that class.

Updates the "Changed" entry for the `NotFoundMiddleware` to indicate its
new constructor arguments.

class NotFoundMiddleware implements MiddlewareInterface
{
const TEMPLATE_DEFAULT = 'error::404';
const LAYOUT_DEFAULT = 'layout::default';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we set visibility for the constants please?

@@ -38,7 +37,7 @@ public function testProviderDefinesExpectedAliases()
{
$config = $this->provider->getDependencies();
$aliases = $config['aliases'];
$this->assertArrayHasKey(Handler\DefaultHandler::class, $aliases);
$this->assertArrayHasKey('Zend\Expressive\Delegate\DefaultDelegate', $aliases);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ConfigProvider we are using ::class notation. I will do the same here.

$container->get(NotFoundHandler::class)->willReturn($handler);
$factory = new NotFoundMiddlewareFactory();
$this->container = $this->prophesize(ContainerInterface::class);
$this->response = $this->prophesize(ResponseInterface::class)->reveal();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this line before $this->container to have container configuration together.
And I would add private property in the class.

@weierophinney weierophinney force-pushed the feature/merge-not-found-handler-and-middleware branch from d529c32 to 6c14c1e Compare February 6, 2018 15:45
weierophinney added a commit to weierophinney/zend-expressive that referenced this pull request Feb 6, 2018
Removes the zendframework#543 entry indicating the changed `NotFoundDelegate`,
instead adding a "Removed" entry for that class.

Updates the "Changed" entry for the `NotFoundMiddleware` to indicate its
new constructor arguments.
Because the `MiddlewarePipe` does not compose a "default handler", and
because the `MiddlewarePipe` is what the request handler runner
dispatches, there is no longer a concept of a "default delegate" (v2) or
"default handler" (v3); there is only middleware.

As such, this patch merges the `NotFoundHandler` into the `NotFoundMiddleware`.

A key is kept for the `DefaultDelegate` service, but it will now resolve
to the `NotFoundMiddleware`.

Fixes zendframework#441.
Removes the zendframework#543 entry indicating the changed `NotFoundDelegate`,
instead adding a "Removed" entry for that class.

Updates the "Changed" entry for the `NotFoundMiddleware` to indicate its
new constructor arguments.
- Adds property for `$response`
- Alters order of operations in `setUp` for consistency
@weierophinney weierophinney force-pushed the feature/merge-not-found-handler-and-middleware branch from 6c14c1e to ba80db2 Compare February 6, 2018 15:50
CHANGELOG.md Outdated
@@ -97,18 +97,19 @@ All notable changes to this project will be documented in this file, in reverse

and removes the dependency http-interop/http-server-middleware.

- [#543](https://github.com/zendframework/zend-expressive/pull/543) renames
- [#543](https://github.com/zendframework/zend-expressive/pull/543) and
[#546](https://github.com/zendframework/zend-expressive/pull/546) renames the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is in 3.0.0alpha2 changelog but milestone for this PR is set to 3.0.0alpha3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crap, you're right. I'll update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentially, I'll be merging all the alpha logs to a single 3.0.0 log later, but for now, needs to be slightly different.

@weierophinney weierophinney merged commit 5fdb648 into zendframework:release-3.0.0 Feb 6, 2018
weierophinney added a commit that referenced this pull request Feb 6, 2018
@weierophinney weierophinney deleted the feature/merge-not-found-handler-and-middleware branch February 6, 2018 16:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants