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

Commit efca8a0

Browse files
committed
Merge branch 'feature/remove-deprecated-functionality' into develop
Close #128
2 parents ff1429b + 523d4b0 commit efca8a0

13 files changed

+104
-299
lines changed

.travis.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,15 @@ env:
2424
matrix:
2525
fast_finish: true
2626
include:
27-
- php: 5.5
28-
env:
29-
- DEPS=lowest
30-
- php: 5.5
31-
env:
32-
- DEPS=locked
33-
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
34-
- PATH="$HOME/.local/bin:$PATH"
35-
- php: 5.5
36-
env:
37-
- DEPS=latest
3827
- php: 5.6
3928
env:
4029
- DEPS=lowest
4130
- php: 5.6
4231
env:
4332
- DEPS=locked
4433
- TEST_COVERAGE=true
34+
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
35+
- PATH="$HOME/.local/bin:$PATH"
4536
- php: 5.6
4637
env:
4738
- DEPS=latest

CHANGELOG.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,27 @@ for full details on how to migrate your v2 application.
9595
functionality from the `ViewHelperManager` factory for fetching configuration
9696
classes from other components and using them to configure the instance. In all
9797
cases, this is now done by the components themselves.
98+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes the
99+
`ControllerLoaderFactory`, and the `ControllerLoader` service alias; use
100+
`ControllerManagerFactory` and `ControllerManager`, respectively, instead.
101+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes
102+
`Zend\Mvc\View\SendResponseListener`; use `Zend\Mvc\SendResponseListener`
103+
instead.
104+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes
105+
`Application::send()`, which has been a no-op since 2.2.
106+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes
107+
`DispatchListener::marshallControllerNotFoundEvent()`, which has proxied to
108+
`marshalControllerNotFoundEvent()` since 2.2.
109+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes
110+
the `ServiceLocatorAwareInterface` implementation
111+
(`setServiceLocator()`/`getServiceLocator()` methods) from
112+
`AbstractController`. You will need to inject your dependencies specifically
113+
going forward.
114+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) removes
115+
the `ServiceLocatorAwareInterface` initializers defined in
116+
`Zend\Mvc\Service\ServiceManagerConfig` and
117+
`Zend\Mvc\Controller\ControllerManager`. You will need to inject your
118+
dependencies specifically going forward.
98119

99120
### Fixed
100121

@@ -103,17 +124,31 @@ for full details on how to migrate your v2 application.
103124
requests optional. `json_decode()` is now used by default, falling back to
104125
`Zend\Json\Json::decode()` if it is available. If neither are available, an
105126
exception is now thrown.
106-
- [#115](https://github.com/zendframework/zend-mvc/pull/115) updates the
127+
- [#115](https://github.com/zendframework/zend-mvc/pull/115) and
128+
[#128](https://github.com/zendframework/zend-mvc/pull/128) update the
107129
dependency list, per https://github.com/zendframework/maintainers/wiki/zend-mvc-v3-refactor:-reduce-components#required-components,
108130
to do the following:
109131
- Makes the following components required:
132+
- zend-http
110133
- zend-modulemanager
134+
- zend-router
111135
- zend-view
112136
- Makes the following components optional:
113-
- zend-form
114-
- zend-hydrator
115137
- zend-json
116138
- zend-psr7bridge
139+
- And pares the suggestion list down to:
140+
- zend-mvc-console
141+
- zend-mvc-i18n
142+
- zend-mvc-plugin-fileprg
143+
- zend-mvc-plugin-flashmessenger
144+
- zend-mvc-plugin-identity
145+
- zend-mvc-plugin-prg
146+
- zend-servicemanager-di
147+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) bumps the minimum
148+
supported version of zend-eventmanager, zend-servicemanager, and zend-stdlib
149+
to their v3 releases.
150+
- [#128](https://github.com/zendframework/zend-mvc/pull/128) bumps the minimum
151+
supported PHP version to 5.6.
117152

118153
## 2.7.7 - TBD
119154

composer.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
}
1414
},
1515
"require": {
16-
"php": "^5.5 || ^7.0",
17-
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
16+
"php": "^5.6 || ^7.0",
17+
"zendframework/zend-eventmanager": "^3.0",
1818
"zendframework/zend-http": "^2.5.4",
1919
"zendframework/zend-modulemanager": "^2.7.1",
2020
"zendframework/zend-router": "^3.0",
21-
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
22-
"zendframework/zend-stdlib": "^2.7.5 || ^3.0",
21+
"zendframework/zend-servicemanager": "^3.0.3",
22+
"zendframework/zend-stdlib": "^3.0",
2323
"zendframework/zend-view": "^2.6.3",
2424
"container-interop/container-interop": "^1.1"
2525
},
@@ -30,20 +30,15 @@
3030
"phpunit/phpunit": "^4.5"
3131
},
3232
"suggest": {
33-
"zendframework/zend-config": "Zend\\Config component",
34-
"zendframework/zend-di": "Zend\\Di component",
35-
"zendframework/zend-http": "Zend\\Http component",
3633
"zendframework/zend-json": "(^2.6.1 || ^3.0) To auto-deserialize JSON body content in AbstractRestfulController extensions, when json_decode is unavailable",
37-
"zendframework/zend-modulemanager": "Zend\\ModuleManager component",
3834
"zendframework/zend-mvc-console": "zend-mvc-console provides the ability to expose zend-mvc as a console application",
3935
"zendframework/zend-mvc-i18n": "zend-mvc-i18n provides integration with zend-i18n, including a translation bridge and translatable route segments",
4036
"zendframework/zend-mvc-plugin-fileprg": "To provide Post/Redirect/Get functionality around forms that container file uploads",
4137
"zendframework/zend-mvc-plugin-flashmessenger": "To provide flash messaging capabilities between requests",
4238
"zendframework/zend-mvc-plugin-identity": "To access the authenticated identity (per zend-authentication) in controllers",
4339
"zendframework/zend-mvc-plugin-prg": "To provide Post/Redirect/Get functionality within controllers",
4440
"zendframework/zend-psr7bridge": "(^0.2) To consume PSR-7 middleware within the MVC workflow",
45-
"zendframework/zend-servicemanager-di": "zend-servicemanager-di provides utilities for integrating zend-di and zend-servicemanager in your zend-mvc application",
46-
"zendframework/zend-view": "Zend\\View component"
41+
"zendframework/zend-servicemanager-di": "zend-servicemanager-di provides utilities for integrating zend-di and zend-servicemanager in your zend-mvc application"
4742
},
4843
"extra": {
4944
"branch-alias": {

doc/book/migration/to-v3-0.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ your application configuration. Components are pushed to the top of the module
3434
list, while modules are pushed to the end. As a development component, it will
3535
not be installed in your production distributions.
3636

37+
## Updated dependencies
38+
39+
The v3 release now *requires*:
40+
41+
- zend-http
42+
- zend-modulemanager
43+
- zend-router
44+
- zend-view
45+
46+
Additionally, the following components require their v3 releases:
47+
48+
- zend-eventmanager
49+
- zend-servicemanager
50+
- zend-stdlib
51+
52+
The minimum supported PHP version was bumped to 5.6.
53+
3754
## Application class
3855

3956
The following changes were made to the `Zend\Mvc\Application` constructor:
@@ -49,6 +66,20 @@ will not notice a change. Those who are directly instantiating the `Application`
4966
instance (in production or test code) or who have created their own factory for
5067
the class will need to update their code.
5168

69+
### send method
70+
71+
The `send()` method has been deprecated since the 2.2 release, and a no-op since
72+
then as well. It is removed starting with the v3 release.
73+
74+
## ControllerLoader
75+
76+
The `ControllerLoader` service was deprecated early in the v2 lifecycle, and
77+
aliased to `ControllerManager`. The `ControllerLoader` factory was kept to
78+
prevent BC breaks due to extending the class.
79+
80+
v3 removes the `ControllerLoaderFactory`, as well as the `ControllerLoader`
81+
service alias.
82+
5283
## DI-ServiceManager integration
5384

5485
The integration between [zend-servicemanager](https://zendframework.github.io/zend-servicemanager) and
@@ -71,6 +102,12 @@ $ composer require zendframework/zend-servicemanager-di
71102
The new component also contains a [migration document](https://zendframework.github.io/zend-servicemanager-di/migration/v2-to-v3/)
72103
detailing potential issues for users migrating to version 3.
73104

105+
## DispatchListener
106+
107+
The `marshallControllerNotFoundEvent()` method was deprecated early in the ZF2
108+
lifecycle, and has proxied to `marshalControllerNotFoundEvent()`. It is removed
109+
with the v3 release.
110+
74111
## Routing
75112

76113
Routing was removed from zend-mvc, and moved to a new component,
@@ -340,6 +377,22 @@ $ composer require zendframework/zend-serializer
340377
Note: the above assumes you have already installed zend-component-installer, per
341378
the section above on [dependency reduction](#dependency-reduction).
342379

380+
## ServiceLocatorAware initializers
381+
382+
Starting with zend-servicemanager v3, that component no longer defines the
383+
`ServiceLocatorAwareInterface`. Since zend-mvc pins against zend-servicemanager
384+
v3 with its own v3 release, the initializers that injected the application
385+
container into implementations of that interface are no longer relevant. As
386+
such, they have now been removed from each of the
387+
`Zend\Mvc\Service\ServiceManagerConfig` and
388+
`Zend\Mvc\Controller\ControllerManager` classes.
389+
390+
Additionally, the duck-typed `ServiceLocatorAwareInterface` implementation in
391+
`AbstractController` was removed, as messaged in the 2.7 release.
392+
393+
If you relied on this functionality, you are encouraged to update your code to
394+
use factories to inject your *actual* dependencies.
395+
343396
## Validator integration
344397

345398
In version 2, zend-mvc exposed a `ValidatorManager` service by default, and
@@ -356,3 +409,9 @@ $ composer require zendframework/zend-validator
356409

357410
Note: the above assumes you have already installed zend-component-installer, per
358411
the section above on [dependency reduction](#dependency-reduction).
412+
413+
## Zend\Mvc\View\SendResponseListener
414+
415+
`Zend\Mvc\View\SendResponseListener` was deprecated with the 2.2 release, and
416+
has been an extension of `Zend\Mvc\SendResponseListener` ever since. It is
417+
removed with the v3 release.

src/Application.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,6 @@ public function run()
350350
return $this;
351351
}
352352

353-
/**
354-
* @deprecated
355-
*/
356-
public function send()
357-
{
358-
}
359-
360353
/**
361354
* Complete the request
362355
*

src/Controller/AbstractController.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Zend\Http\Request as HttpRequest;
1818
use Zend\Mvc\InjectApplicationEventInterface;
1919
use Zend\Mvc\MvcEvent;
20-
use Zend\ServiceManager\ServiceLocatorInterface;
2120
use Zend\ServiceManager\ServiceManager;
2221
use Zend\Stdlib\DispatchableInterface as Dispatchable;
2322
use Zend\Stdlib\RequestInterface as Request;
@@ -56,11 +55,6 @@ abstract class AbstractController implements
5655
*/
5756
protected $response;
5857

59-
/**
60-
* @var ServiceLocatorInterface
61-
*/
62-
protected $serviceLocator;
63-
6458
/**
6559
* @var Event
6660
*/
@@ -223,36 +217,6 @@ public function getEvent()
223217
return $this->event;
224218
}
225219

226-
/**
227-
* Set serviceManager instance
228-
*
229-
* @param ServiceLocatorInterface $serviceLocator
230-
* @return void
231-
*/
232-
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
233-
{
234-
$this->serviceLocator = $serviceLocator;
235-
}
236-
237-
/**
238-
* Retrieve serviceManager instance
239-
*
240-
* @return ServiceLocatorInterface
241-
*/
242-
public function getServiceLocator()
243-
{
244-
trigger_error(sprintf(
245-
'You are retrieving the service locator from within the class %s. Please be aware that '
246-
. 'ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along '
247-
. 'with the ServiceLocatorAwareInitializer. You will need to update your class to accept '
248-
. 'all dependencies at creation, either via constructor arguments or setters, and use '
249-
. 'a factory to perform the injections.',
250-
get_class($this)
251-
), E_USER_DEPRECATED);
252-
253-
return $this->serviceLocator;
254-
}
255-
256220
/**
257221
* Get plugin manager
258222
*

src/Controller/ControllerManager.php

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Zend\ServiceManager\AbstractPluginManager;
1717
use Zend\ServiceManager\ConfigInterface;
1818
use Zend\ServiceManager\Exception\InvalidServiceException;
19-
use Zend\ServiceManager\ServiceLocatorAwareInterface;
2019
use Zend\Stdlib\DispatchableInterface;
2120

2221
/**
@@ -54,10 +53,6 @@ public function __construct($configOrContainerInstance, array $v3config = [])
5453
$this->addInitializer([$this, 'injectEventManager']);
5554
$this->addInitializer([$this, 'injectPluginManager']);
5655
parent::__construct($configOrContainerInstance, $v3config);
57-
58-
// Added after parent construction, as v2 abstract plugin managers add
59-
// one during construction.
60-
$this->addInitializer([$this, 'injectServiceLocator']);
6156
}
6257

6358
/**
@@ -165,52 +160,4 @@ public function injectPluginManager($first, $second)
165160

166161
$controller->setPluginManager($container->get('ControllerPluginManager'));
167162
}
168-
169-
/**
170-
* Initializer: inject service locator
171-
*
172-
* @param ContainerInterface|DispatchableInterface $first Container when
173-
* using zend-servicemanager v3; controller under v2.
174-
* @param DispatchableInterface|ContainerInterface $second Controller when
175-
* using zend-servicemanager v3; container under v2.
176-
*/
177-
public function injectServiceLocator($first, $second)
178-
{
179-
if ($first instanceof ContainerInterface) {
180-
$container = $first;
181-
$controller = $second;
182-
} else {
183-
$container = $second;
184-
$controller = $first;
185-
}
186-
187-
// For v2, we need to pull the parent service locator
188-
if (! method_exists($container, 'configure')) {
189-
$container = $container->getServiceLocator() ?: $container;
190-
}
191-
192-
// Inject AbstractController extensions that are not ServiceLocatorAware
193-
// with the service manager, but do not emit a deprecation notice. We'll
194-
// emit it from AbstractController::getServiceLocator() instead.
195-
if (! $controller instanceof ServiceLocatorAwareInterface
196-
&& $controller instanceof AbstractController
197-
&& method_exists($controller, 'setServiceLocator')
198-
) {
199-
// Do not emit deprecation notice in this case
200-
$controller->setServiceLocator($container);
201-
}
202-
203-
// If a controller implements ServiceLocatorAwareInterface explicitly, we
204-
// inject, but emit a deprecation notice. Since AbstractController no longer
205-
// explicitly does this, this will only affect userland controllers.
206-
if ($controller instanceof ServiceLocatorAwareInterface) {
207-
trigger_error(sprintf(
208-
'ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along '
209-
. 'with the ServiceLocatorAwareInitializer. Please update your class %s to remove '
210-
. 'the implementation, and start injecting your dependencies via factory instead.',
211-
get_class($controller)
212-
), E_USER_DEPRECATED);
213-
$controller->setServiceLocator($container);
214-
}
215-
}
216163
}

src/DispatchListener.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -193,33 +193,6 @@ protected function marshalControllerNotFoundEvent(
193193
return $return;
194194
}
195195

196-
/**
197-
* Marshal a controller not found exception event
198-
*
199-
* @deprecated Use marshalControllerNotFoundEvent() instead
200-
* @param string $type
201-
* @param string $controllerName
202-
* @param MvcEvent $event
203-
* @param Application $application
204-
* @param \Exception $exception
205-
* @return mixed
206-
*/
207-
protected function marshallControllerNotFoundEvent(
208-
$type,
209-
$controllerName,
210-
MvcEvent $event,
211-
Application $application,
212-
\Exception $exception = null
213-
) {
214-
trigger_error(sprintf(
215-
'%s is deprecated; please use %s::marshalControllerNotFoundEvent instead',
216-
__METHOD__,
217-
__CLASS__
218-
), E_USER_DEPRECATED);
219-
220-
return $this->marshalControllerNotFoundEvent($type, $controllerName, $event, $application, $exception);
221-
}
222-
223196
/**
224197
* Marshal a bad controller exception event
225198
*

0 commit comments

Comments
 (0)