diff --git a/composer.json b/composer.json index 08f6569ed..18fa694b9 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "zendframework/zend-servicemanager": "dev-develop as 2.6.0", "zendframework/zend-hydrator": "~1.0", "zendframework/zend-form": "~2.6", - "zendframework/zend-stdlib": "~2.7", + "zendframework/zend-stdlib": "dev-develop as 2.8.0", "zendframework/zend-psr7bridge": "^0.2", "container-interop/container-interop": "^1.1" }, diff --git a/src/Application.php b/src/Application.php index 517c7aa7a..50fc52dc3 100644 --- a/src/Application.php +++ b/src/Application.php @@ -262,7 +262,7 @@ public static function init($configuration = []) $smConfig = new Service\ServiceManagerConfig($smConfig); $serviceManager = new ServiceManager($smConfig->toArray()); - $serviceManager = $serviceManager->withConfig(['services' => [ + $serviceManager = $serviceManager->configure(['services' => [ 'ApplicationConfig' => $configuration, ]]); diff --git a/src/Router/Console/SimpleRouteStack.php b/src/Router/Console/SimpleRouteStack.php index 21c144503..b54bf593a 100644 --- a/src/Router/Console/SimpleRouteStack.php +++ b/src/Router/Console/SimpleRouteStack.php @@ -27,7 +27,7 @@ class SimpleRouteStack extends BaseSimpleRouteStack protected function init() { $routes = $this->routePluginManager; - $this->routePluginManager = $routes->withConfig(['invokables' => [ + $this->routePluginManager = $routes->configure(['invokables' => [ 'catchall' => __NAMESPACE__ . '\Catchall', 'simple' => __NAMESPACE__ . '\Simple', ]]); diff --git a/src/Router/Http/TreeRouteStack.php b/src/Router/Http/TreeRouteStack.php index 7581d40d6..71d7aa069 100644 --- a/src/Router/Http/TreeRouteStack.php +++ b/src/Router/Http/TreeRouteStack.php @@ -81,7 +81,7 @@ protected function init() $this->prototypes = new ArrayObject; $routes = $this->routePluginManager; - $this->routePluginManager = $routes->withConfig([ + $this->routePluginManager = $routes->configure([ 'aliases' => [ 'Chain' => 'chain', 'Hostname' => 'hostname', diff --git a/src/Router/RoutePluginManager.php b/src/Router/RoutePluginManager.php index b58e0f4c1..c4d4360f7 100644 --- a/src/Router/RoutePluginManager.php +++ b/src/Router/RoutePluginManager.php @@ -65,9 +65,9 @@ public function __construct(ContainerInterface $container, array $config = []) * before passing to the parent. * * @param array $config - * @return void + * @return self */ - protected function configure(array $config) + public function configure(array $config) { if (isset($config['invokables']) && ! empty($config['invokables'])) { $aliases = $this->createAliasesForInvokables($config['invokables']); @@ -86,7 +86,7 @@ protected function configure(array $config) unset($config['invokables']); } - parent::configure($config); + return parent::configure($config); } /** diff --git a/test/ApplicationTest.php b/test/ApplicationTest.php index f706d0d4d..7cb1b555f 100644 --- a/test/ApplicationTest.php +++ b/test/ApplicationTest.php @@ -246,6 +246,7 @@ public function testBootstrapRegistersConfiguredMvcEvent() public function setupPathController($addService = true) { + $this->serviceManager->setAllowOverride(true); $request = $this->serviceManager->get('Request'); $request->setUri('http://example.local/path'); @@ -257,7 +258,7 @@ public function setupPathController($addService = true) ], ]); $router->addRoute('path', $route); - $services = $this->serviceManager->withConfig([ + $services = $this->serviceManager->configure([ 'aliases' => [ 'Router' => 'HttpRouter', ], @@ -268,7 +269,7 @@ public function setupPathController($addService = true) $application = $this->setApplicationServiceManager($this->application, $services); if ($addService) { - $services = $services->withConfig(['factories' => [ + $services = $services->configure(['factories' => [ 'ControllerManager' => function ($services) { return new ControllerManager($services, ['factories' => [ 'path' => function () { @@ -299,7 +300,7 @@ public function setupActionController() ]); $router->addRoute('sample', $route); - $services = $this->serviceManager->withConfig(['factories' => [ + $services = $this->serviceManager->configure(['factories' => [ 'ControllerManager' => function ($services) { return new ControllerManager($services, ['factories' => [ 'sample' => function () { @@ -331,7 +332,7 @@ public function setupBadController($addService = true) $application = $this->application; if ($addService) { - $services = $this->serviceManager->withConfig(['factories' => [ + $services = $this->serviceManager->configure(['factories' => [ 'ControllerManager' => function ($services) { return new ControllerManager($services, ['factories' => [ 'bad' => function () { diff --git a/test/Controller/Plugin/ForwardTest.php b/test/Controller/Plugin/ForwardTest.php index c4211acac..aaddb61a2 100644 --- a/test/Controller/Plugin/ForwardTest.php +++ b/test/Controller/Plugin/ForwardTest.php @@ -120,7 +120,7 @@ public function testPluginWithoutControllerLocatorRaisesServiceNotCreatedExcepti public function testDispatchRaisesDomainExceptionIfDiscoveredControllerIsNotDispatchable() { - $controllers = $this->controllers->withConfig(['factories' => [ + $controllers = $this->controllers->configure(['factories' => [ 'bogus' => function () { return new stdClass; }, diff --git a/test/Service/ControllerManagerFactoryTest.php b/test/Service/ControllerManagerFactoryTest.php index 2253ad7f0..67f94fa6e 100644 --- a/test/Service/ControllerManagerFactoryTest.php +++ b/test/Service/ControllerManagerFactoryTest.php @@ -79,7 +79,7 @@ public function testCannotLoadControllerFromPeer() public function testControllerLoadedCanBeInjectedWithValuesFromPeer() { $loader = $this->services->get('ControllerManager'); - $loader = $loader->withConfig(['invokables' => [ + $loader = $loader->configure(['invokables' => [ 'ZendTest\Dispatchable' => TestAsset\Dispatchable::class, ]]); @@ -91,8 +91,9 @@ public function testControllerLoadedCanBeInjectedWithValuesFromPeer() public function testCallPluginWithControllerPluginManager() { + $this->services->setAllowOverride(true); $controllerPluginManager = $this->services->get('ControllerPluginManager'); - $controllerPluginManager = $controllerPluginManager->withConfig([ + $controllerPluginManager = $controllerPluginManager->configure([ 'invokables' => [ 'samplePlugin' => 'ZendTest\Mvc\Controller\Plugin\TestAsset\SamplePlugin', ], @@ -101,7 +102,7 @@ public function testCallPluginWithControllerPluginManager() $controller = new \ZendTest\Mvc\Controller\TestAsset\SampleController; $controllerPluginManager->setController($controller); - $services = $this->services->withConfig(['services' => [ + $services = $this->services->configure(['services' => [ 'ControllerPluginManager' => $controllerPluginManager, ]]); diff --git a/test/Service/ServiceManagerConfigTest.php b/test/Service/ServiceManagerConfigTest.php index ef63793a4..7c535e7e8 100644 --- a/test/Service/ServiceManagerConfigTest.php +++ b/test/Service/ServiceManagerConfigTest.php @@ -48,7 +48,7 @@ public function testEventManagerAwareInterfaceIsNotInjectedIfPresentButSharedMan $events = new EventManager($this->services->get('SharedEventManager')); TestAsset\EventManagerAwareObject::$defaultEvents = $events; - $services = $this->services->withConfig(['invokables' => [ + $services = $this->services->configure(['invokables' => [ 'EventManagerAwareObject' => TestAsset\EventManagerAwareObject::class, ]]); diff --git a/test/Service/ViewHelperManagerFactoryTest.php b/test/Service/ViewHelperManagerFactoryTest.php index c43aed988..1d32c36a7 100644 --- a/test/Service/ViewHelperManagerFactoryTest.php +++ b/test/Service/ViewHelperManagerFactoryTest.php @@ -49,7 +49,7 @@ public function emptyConfiguration() */ public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($config) { - $services = $this->services->withConfig(['services' => [ + $services = $this->services->configure(['services' => [ 'config' => $config, ]]); $manager = $this->factory->__invoke($services, 'ViewHelperManager'); @@ -60,7 +60,7 @@ public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($confi public function testConsoleRequestsResultInSilentFailure() { - $services = $this->services->withConfig(['services' => [ + $services = $this->services->configure(['services' => [ 'config' => [], 'Request' => new ConsoleRequest(), ]]); @@ -88,7 +88,7 @@ public function testConsoleRequestWithBasePathConsole() $this->markTestSkipped('Cannot force console context; skipping test'); } - $services = $this->services->withConfig(['services' => [ + $services = $this->services->configure(['services' => [ 'config' => [ 'view_manager' => [ 'base_path_console' => 'http://test.com', diff --git a/test/View/Console/ViewManagerTest.php b/test/View/Console/ViewManagerTest.php index 4bd7aea5d..0e1935804 100644 --- a/test/View/Console/ViewManagerTest.php +++ b/test/View/Console/ViewManagerTest.php @@ -124,7 +124,7 @@ public function testConsoleKeyWillOverrideDisplayExceptionAndExceptionMessage($c $request = new ConsoleRequest(); $response = new ConsoleResponse(); - $services = $this->services->withConfig(['services' => [ + $services = $this->services->configure(['services' => [ 'config' => $config, 'Request' => $request, 'EventManager' => $eventManager, @@ -152,7 +152,7 @@ public function testConsoleDisplayExceptionIsTrue() $request = new ConsoleRequest(); $response = new ConsoleResponse(); - $services = $this->services->withConfig([ + $services = $this->services->configure([ 'services' => [ 'config' => [], 'Request' => $request,