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

Commit 937c5b0

Browse files
committed
Merge branch 'feature/implicit-middleware-aliases' into release-3.0.0
Close #554
2 parents 5a23143 + cb542ef commit 937c5b0

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ All notable changes to this project will be documented in this file, in reverse
1212
capable of producing an empty, writable PSR-7 `StreamInterface` instance using
1313
zend-diactoros. The stream produced is backed by a `php://temp` stream.
1414

15-
- [#551](https://github.com/zendframework/zend-expressive/pull/551) adds
15+
- [#551](https://github.com/zendframework/zend-expressive/pull/551) and
16+
[#554](https://github.com/zendframework/zend-expressive/pull/554) add
1617
the following constants under the `Zend\Expressive` namespace:
1718

1819
- `DEFAULT_DELEGATE` can be used to refer to the former `DefaultDelegate` FQCN service.
20+
- `IMPLICIT_HEAD_MIDDLEWARE` can be used to refer to the former `Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware` service.
21+
- `IMPLICIT_OPTIONS_MIDDLEWARE` can be used to refer to the former `Zend\Expressive\Router\Middleware\ImplicitOPTIONSMiddleware` service.
1922
- `NOT_FOUND_MIDDLEWARE` can be used to refer to the former `Zend\Expressive\Middleware\NotFoundMiddleware` service.
2023
- `NOT_FOUND_RESPONSE` can be used to refer to the former `Zend\Expressive\Response\NotFoundResponseInterface` service.
2124
- `SERVER_REQUEST_ERROR_RESPONSE_GENERATOR` can be used to refer to the former `Zend\Expressive\ServerRequestErrorResponseGenerator` service.
@@ -47,6 +50,12 @@ All notable changes to this project will be documented in this file, in reverse
4750
- `IMPLICIT_HEAD_MIDDLEWARE_STREAM_FACTORY` maps to the `StreamFactory`.
4851
- `IMPLICIT_OPTIONS_MIDDLEWARE_RESPONSE` maps to the `ResponseFactory`.
4952

53+
- [#554](https://github.com/zendframework/zend-expressive/pull/554) updates
54+
the `ConfigProvider` to add entries for the following constants as follows:
55+
56+
- `IMPLICIT_HEAD_MIDDLEWARE` aliases to the `Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware` service.
57+
- `IMPLICIT_OPTIONS_MIDDLEWARE` aliases to the `Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware` service.
58+
5059
### Deprecated
5160

5261
- Nothing.

src/ConfigProvider.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ public function getDependencies() : array
3232
// @codingStandardsIgnoreStart
3333
return [
3434
'aliases' => [
35-
DEFAULT_DELEGATE => Handler\NotFoundHandler::class,
36-
DISPATCH_MIDDLEWARE => Router\Middleware\DispatchMiddleware::class,
37-
NOT_FOUND_MIDDLEWARE => Handler\NotFoundHandler::class,
38-
ROUTE_MIDDLEWARE => Router\Middleware\PathBasedRoutingMiddleware::class,
35+
DEFAULT_DELEGATE => Handler\NotFoundHandler::class,
36+
DISPATCH_MIDDLEWARE => Router\Middleware\DispatchMiddleware::class,
37+
IMPLICIT_HEAD_MIDDLEWARE => Router\Middleware\ImplicitHeadMiddleware::class,
38+
IMPLICIT_OPTIONS_MIDDLEWARE => Router\Middleware\ImplicitOptionsMiddleware::class,
39+
NOT_FOUND_MIDDLEWARE => Handler\NotFoundHandler::class,
40+
ROUTE_MIDDLEWARE => Router\Middleware\PathBasedRoutingMiddleware::class,
3941
],
4042
'factories' => [
4143
Application::class => Container\ApplicationFactory::class,

src/constants.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@
2828
*/
2929
const DISPATCH_MIDDLEWARE = __NAMESPACE__ . '\Middleware\DispatchMiddleware';
3030

31+
/**
32+
* Legacy service name for the ImplicitHeadMiddleware referenced in version 2.
33+
* Should resolve to the Zend\Expressive\Router\Middleware\ImplicitHeadMiddleware
34+
* service.
35+
*
36+
* @deprecated To remove in version 4.0.0.
37+
* @var string
38+
*/
39+
const IMPLICIT_HEAD_MIDDLEWARE = __NAMESPACE__ . '\Middleware\ImplicitHeadMiddleware';
40+
41+
/**
42+
* Legacy service name for the ImplicitOptionsMiddleware referenced in version 2.
43+
* Should resolve to the Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware
44+
* service.
45+
*
46+
* @deprecated To remove in version 4.0.0.
47+
* @var string
48+
*/
49+
const IMPLICIT_OPTIONS_MIDDLEWARE = __NAMESPACE__ . '\Middleware\ImplicitOptionsMiddleware';
50+
3151
/**
3252
* Legacy/transitional service name for the NotFoundMiddleware introduced in
3353
* 3.0.0alpha2. Should resolve to the Handler\NotFoundHandler class.

test/ConfigProviderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
use const Zend\Expressive\DEFAULT_DELEGATE;
2828
use const Zend\Expressive\DISPATCH_MIDDLEWARE;
29+
use const Zend\Expressive\IMPLICIT_HEAD_MIDDLEWARE;
30+
use const Zend\Expressive\IMPLICIT_OPTIONS_MIDDLEWARE;
2931
use const Zend\Expressive\NOT_FOUND_MIDDLEWARE;
3032
use const Zend\Expressive\NOT_FOUND_RESPONSE;
3133
use const Zend\Expressive\ROUTE_MIDDLEWARE;
@@ -49,6 +51,8 @@ public function testProviderDefinesExpectedAliases()
4951
$aliases = $config['aliases'];
5052
$this->assertArrayHasKey(DEFAULT_DELEGATE, $aliases);
5153
$this->assertArrayHasKey(DISPATCH_MIDDLEWARE, $aliases);
54+
$this->assertArrayHasKey(IMPLICIT_HEAD_MIDDLEWARE, $aliases);
55+
$this->assertArrayHasKey(IMPLICIT_OPTIONS_MIDDLEWARE, $aliases);
5256
$this->assertArrayHasKey(NOT_FOUND_MIDDLEWARE, $aliases);
5357
$this->assertArrayHasKey(ROUTE_MIDDLEWARE, $aliases);
5458
}

0 commit comments

Comments
 (0)