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

Commit 8142dbe

Browse files
snapshotplXerkus
authored andcommitted
Remove support for sm v2
1 parent b15a5b7 commit 8142dbe

32 files changed

+49
-510
lines changed

src/Controller/ControllerManager.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,6 @@ public function validate($plugin)
7171
}
7272
}
7373

74-
/**
75-
* Validate a plugin (v2)
76-
*
77-
* {@inheritDoc}
78-
*
79-
* @throws Exception\InvalidControllerException
80-
*/
81-
public function validatePlugin($plugin)
82-
{
83-
try {
84-
$this->validate($plugin);
85-
} catch (InvalidServiceException $e) {
86-
throw new Exception\InvalidControllerException(
87-
$e->getMessage(),
88-
$e->getCode(),
89-
$e
90-
);
91-
}
92-
}
93-
9474
/**
9575
* Initializer: inject EventManager instance
9676
*

src/Controller/Plugin/Service/ForwardFactory.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
namespace Zend\Mvc\Controller\Plugin\Service;
1111

1212
use Interop\Container\ContainerInterface;
13-
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
1613
use Zend\Mvc\Controller\Plugin\Forward;
14+
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
15+
use Zend\ServiceManager\Factory\FactoryInterface;
1716

1817
class ForwardFactory implements FactoryInterface
1918
{
@@ -36,18 +35,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3635

3736
return new Forward($controllers);
3837
}
39-
40-
/**
41-
* Create and return Forward instance
42-
*
43-
* For use with zend-servicemanager v2; proxies to __invoke().
44-
*
45-
* @param ServiceLocatorInterface $container
46-
* @return Forward
47-
*/
48-
public function createService(ServiceLocatorInterface $container)
49-
{
50-
$parentContainer = $container->getServiceLocator() ?: $container;
51-
return $this($parentContainer, Forward::class);
52-
}
5338
}

src/Service/AbstractPluginManagerFactory.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\ServiceManager\AbstractPluginManager;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615

1716
abstract class AbstractPluginManagerFactory implements FactoryInterface
1817
{
@@ -35,17 +34,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3534
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
3635
return new $pluginManagerClass($container, $options);
3736
}
38-
39-
/**
40-
* Create and return AbstractPluginManager instance
41-
*
42-
* For use with zend-servicemanager v2; proxies to __invoke().
43-
*
44-
* @param ServiceLocatorInterface $container
45-
* @return AbstractPluginManager
46-
*/
47-
public function createService(ServiceLocatorInterface $container)
48-
{
49-
return $this($container, AbstractPluginManager::class);
50-
}
5137
}

src/Service/ApplicationFactory.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Mvc\Application;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615

1716
class ApplicationFactory implements FactoryInterface
1817
{
1918
/**
20-
* Create the Application service (v3)
19+
* Create the Application service
2120
*
2221
* Creates a Zend\Mvc\Application service, passing it the configuration
2322
* service and the service manager instance.
@@ -36,17 +35,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3635
$container->get('Response')
3736
);
3837
}
39-
40-
/**
41-
* Create the Application service (v2)
42-
*
43-
* Proxies to __invoke().
44-
*
45-
* @param ServiceLocatorInterface $container
46-
* @return Application
47-
*/
48-
public function createService(ServiceLocatorInterface $container)
49-
{
50-
return $this($container, Application::class);
51-
}
5238
}

src/Service/ConfigFactory.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace Zend\Mvc\Service;
1111

1212
use Interop\Container\ContainerInterface;
13-
use Zend\ServiceManager\FactoryInterface;
14-
use Zend\ServiceManager\ServiceLocatorInterface;
13+
use Traversable;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1515

1616
class ConfigFactory implements FactoryInterface
1717
{
@@ -27,7 +27,7 @@ class ConfigFactory implements FactoryInterface
2727
* @param ContainerInterface $container
2828
* @param string $name
2929
* @param null|array $options
30-
* @return array|\Traversable
30+
* @return array|Traversable
3131
*/
3232
public function __invoke(ContainerInterface $container, $name, array $options = null)
3333
{
@@ -36,17 +36,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3636
$moduleParams = $moduleManager->getEvent()->getParams();
3737
return $moduleParams['configListener']->getMergedConfig(false);
3838
}
39-
40-
/**
41-
* Create and return config instance
42-
*
43-
* For use with zend-servicemanager v2; proxies to __invoke().
44-
*
45-
* @param ServiceLocatorInterface $container
46-
* @return array|\Traversable
47-
*/
48-
public function createService(ServiceLocatorInterface $container)
49-
{
50-
return $this($container, 'config');
51-
}
5239
}

src/Service/ControllerManagerFactory.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Mvc\Controller\ControllerManager;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615

1716
class ControllerManagerFactory implements FactoryInterface
1817
{
@@ -38,17 +37,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3837
}
3938
return new ControllerManager($container);
4039
}
41-
42-
/**
43-
* Create and return ControllerManager instance
44-
*
45-
* For use with zend-servicemanager v2; proxies to __invoke().
46-
*
47-
* @param ServiceLocatorInterface $container
48-
* @return ControllerManager
49-
*/
50-
public function createService(ServiceLocatorInterface $container)
51-
{
52-
return $this($container, ControllerManager::class);
53-
}
5440
}

src/Service/DispatchListenerFactory.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Mvc\DispatchListener;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615

1716
class DispatchListenerFactory implements FactoryInterface
1817
{
@@ -28,17 +27,4 @@ public function __invoke(ContainerInterface $container, $name, array $options =
2827
{
2928
return new DispatchListener($container->get('ControllerManager'));
3029
}
31-
32-
/**
33-
* Create and return DispatchListener instance
34-
*
35-
* For use with zend-servicemanager v2; proxies to __invoke().
36-
*
37-
* @param ServiceLocatorInterface $container
38-
* @return DispatchListener
39-
*/
40-
public function createService(ServiceLocatorInterface $container)
41-
{
42-
return $this($container, DispatchListener::class);
43-
}
4430
}

src/Service/EventManagerFactory.php

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
namespace Zend\Mvc\Service;
1111

1212
use Interop\Container\ContainerInterface;
13-
use ReflectionClass;
1413
use Zend\EventManager\EventManager;
15-
use Zend\ServiceManager\FactoryInterface;
16-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1715

1816
class EventManagerFactory implements FactoryInterface
1917
{
@@ -30,48 +28,8 @@ class EventManagerFactory implements FactoryInterface
3028
*/
3129
public function __invoke(ContainerInterface $container, $name, array $options = null)
3230
{
33-
if ($this->acceptsSharedManagerToConstructor()) {
34-
// zend-eventmanager v3
35-
return new EventManager(
36-
$container->has('SharedEventManager') ? $container->get('SharedEventManager') : null
37-
);
38-
}
31+
$shared = $container->has('SharedEventManager') ? $container->get('SharedEventManager') : null;
3932

40-
// zend-eventmanager v2
41-
$events = new EventManager();
42-
43-
if ($container->has('SharedEventManager')) {
44-
$events->setSharedManager($container->get('SharedEventManager'));
45-
}
46-
47-
return $events;
48-
}
49-
50-
/**
51-
* Create and return EventManager instance
52-
*
53-
* For use with zend-servicemanager v2; proxies to __invoke().
54-
*
55-
* @param ServiceLocatorInterface $container
56-
* @return EventManager
57-
*/
58-
public function createService(ServiceLocatorInterface $container)
59-
{
60-
return $this($container, EventManager::class);
61-
}
62-
63-
/**
64-
* Does the EventManager accept the shared manager to the constructor?
65-
*
66-
* In zend-eventmanager v3, the EventManager accepts the shared manager
67-
* instance to the constructor *only*, while in v2, it must be injected
68-
* via the setSharedManager() method.
69-
*
70-
* @return bool
71-
*/
72-
private function acceptsSharedManagerToConstructor()
73-
{
74-
$r = new ReflectionClass(EventManager::class);
75-
return ! $r->hasMethod('setSharedManager');
33+
return new EventManager($shared);
7634
}
7735
}

src/Service/HttpDefaultRenderingStrategyFactory.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Mvc\View\Http\DefaultRenderingStrategy;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615
use Zend\View\View;
1716

1817
class HttpDefaultRenderingStrategyFactory implements FactoryInterface
@@ -35,19 +34,6 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3534
return $strategy;
3635
}
3736

38-
/**
39-
* Create and return DefaultRendererStrategy instance
40-
*
41-
* For use with zend-servicemanager v2; proxies to __invoke().
42-
*
43-
* @param ServiceLocatorInterface $container
44-
* @return DefaultRendererStrategy
45-
*/
46-
public function createService(ServiceLocatorInterface $container)
47-
{
48-
return $this($container, DefaultRendererStrategy::class);
49-
}
50-
5137
/**
5238
* Inject layout template.
5339
*

src/Service/HttpExceptionStrategyFactory.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use Interop\Container\ContainerInterface;
1313
use Zend\Mvc\View\Http\ExceptionStrategy;
14-
use Zend\ServiceManager\FactoryInterface;
15-
use Zend\ServiceManager\ServiceLocatorInterface;
14+
use Zend\ServiceManager\Factory\FactoryInterface;
1615

1716
class HttpExceptionStrategyFactory implements FactoryInterface
1817
{
@@ -35,19 +34,6 @@ public function __invoke(ContainerInterface $container, $name, array $options =
3534
return $strategy;
3635
}
3736

38-
/**
39-
* Create and return ExceptionStrategy instance
40-
*
41-
* For use with zend-servicemanager v2; proxies to __invoke().
42-
*
43-
* @param ServiceLocatorInterface $container
44-
* @return ExceptionStrategy
45-
*/
46-
public function createService(ServiceLocatorInterface $container)
47-
{
48-
return $this($container, ExceptionStrategy::class);
49-
}
50-
5137
/**
5238
* Inject strategy with configured display_exceptions flag.
5339
*

0 commit comments

Comments
 (0)