From 5a8ee385dbcfd9d9bce6586fa64dedccc51d75f9 Mon Sep 17 00:00:00 2001 From: Dusan Vejin Date: Fri, 23 Jun 2017 20:42:23 +0200 Subject: [PATCH 1/3] Missing strict types --- src/Bootstrap/Bootstrap.php | 2 +- src/Config/Config.php | 2 +- src/Di/Container/Factory/AbstractFactory.php | 6 +++--- src/Di/Container/Factory/AuraDiFactory.php | 5 +++-- src/Di/Container/Factory/PimpleFactory.php | 5 +++-- src/Di/Container/Factory/ZendServiceManagerFactory.php | 5 +++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Bootstrap/Bootstrap.php b/src/Bootstrap/Bootstrap.php index b2627ea..94194c9 100644 --- a/src/Bootstrap/Bootstrap.php +++ b/src/Bootstrap/Bootstrap.php @@ -49,7 +49,7 @@ public function __construct(ConfigLoaderInterface $configLoader, DiContainerFact $this->diContainerFactory = $diContainerFactory; } - public function __invoke() + public function __invoke() : ContainerInterface { $this->loadConfig(); $this->buildDiContainer(); diff --git a/src/Config/Config.php b/src/Config/Config.php index 3e8329a..cb08ff8 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -19,7 +19,7 @@ */ class Config extends ArrayObject { - public static function fromArray(array $config) + public static function fromArray(array $config) : Config { return new self($config); } diff --git a/src/Di/Container/Factory/AbstractFactory.php b/src/Di/Container/Factory/AbstractFactory.php index 38ea914..a297027 100644 --- a/src/Di/Container/Factory/AbstractFactory.php +++ b/src/Di/Container/Factory/AbstractFactory.php @@ -49,11 +49,11 @@ public function __invoke(Config $config) : ContainerInterface return $container; } - abstract protected function createContainer(); + abstract protected function createContainer() : ContainerInterface; - abstract protected function configure($container); + abstract protected function configure(ContainerInterface $container); - final protected function getConfig() + final protected function getConfig() : Config { return $this->config; } diff --git a/src/Di/Container/Factory/AuraDiFactory.php b/src/Di/Container/Factory/AuraDiFactory.php index 5b2a86f..acd1566 100644 --- a/src/Di/Container/Factory/AuraDiFactory.php +++ b/src/Di/Container/Factory/AuraDiFactory.php @@ -14,6 +14,7 @@ use Aura\Di\Container; use Aura\Di\ContainerBuilder; +use Interop\Container\ContainerInterface; /** * @author Nikola Posa @@ -25,12 +26,12 @@ final class AuraDiFactory extends AbstractFactory */ protected $container; - protected function createContainer() + protected function createContainer() : ContainerInterface { return (new ContainerBuilder())->newInstance(); } - protected function configure($container) + protected function configure(ContainerInterface $container) { $this->container = $container; diff --git a/src/Di/Container/Factory/PimpleFactory.php b/src/Di/Container/Factory/PimpleFactory.php index 630310e..27a2a57 100644 --- a/src/Di/Container/Factory/PimpleFactory.php +++ b/src/Di/Container/Factory/PimpleFactory.php @@ -12,6 +12,7 @@ namespace Phoundation\Di\Container\Factory; +use Interop\Container\ContainerInterface; use Xtreamwayz\Pimple\Container; /** @@ -24,12 +25,12 @@ final class PimpleFactory extends AbstractFactory */ private $container; - protected function createContainer() + protected function createContainer() : ContainerInterface { return new Container(); } - protected function configure($container) + protected function configure(ContainerInterface $container) { $this->container = $container; diff --git a/src/Di/Container/Factory/ZendServiceManagerFactory.php b/src/Di/Container/Factory/ZendServiceManagerFactory.php index 66de10d..46420f4 100644 --- a/src/Di/Container/Factory/ZendServiceManagerFactory.php +++ b/src/Di/Container/Factory/ZendServiceManagerFactory.php @@ -12,6 +12,7 @@ namespace Phoundation\Di\Container\Factory; +use Interop\Container\ContainerInterface; use Zend\ServiceManager\ServiceManager; /** @@ -19,12 +20,12 @@ */ final class ZendServiceManagerFactory extends AbstractFactory { - protected function createContainer() + protected function createContainer() : ContainerInterface { return new ServiceManager(); } - protected function configure($container) + protected function configure(ContainerInterface $container) { /* @var $container ServiceManager */ From a2b15bf63a9e82139c095e11ab6de770a85561d7 Mon Sep 17 00:00:00 2001 From: Dusan Vejin Date: Fri, 23 Jun 2017 20:53:42 +0200 Subject: [PATCH 2/3] Migrating from container-interop to PSR-11 --- composer.json | 4 ++-- src/Bootstrap/Bootstrap.php | 2 +- src/Di/Container/Factory/AbstractFactory.php | 2 +- src/Di/Container/Factory/AuraDiFactory.php | 2 +- src/Di/Container/Factory/DiContainerFactoryInterface.php | 2 +- src/Di/Container/Factory/PimpleFactory.php | 2 +- src/Di/Container/Factory/ZendServiceManagerFactory.php | 2 +- tests/Bootstrap/BootstrapTest.php | 2 +- tests/Di/Container/Factory/ContainerFactoryTest.php | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index d342d03..1643ce6 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ ], "require": { "php": "^7.0", - "container-interop/container-interop": "^1.1", - "psr/log": "^1.0" + "psr/log": "^1.0", + "psr/container": "^1.0" }, "require-dev": { "phpunit/phpunit": "^5.7 || ^6.0", diff --git a/src/Bootstrap/Bootstrap.php b/src/Bootstrap/Bootstrap.php index 94194c9..580c2c6 100644 --- a/src/Bootstrap/Bootstrap.php +++ b/src/Bootstrap/Bootstrap.php @@ -15,8 +15,8 @@ use Phoundation\Config\Loader\ConfigLoaderInterface; use Phoundation\Di\Container\Factory\DiContainerFactoryInterface; use Phoundation\Config\Config; -use Interop\Container\ContainerInterface; use Phoundation\ErrorHandling\RunnerInterface; +use Psr\Container\ContainerInterface; /** * @author Nikola Posa diff --git a/src/Di/Container/Factory/AbstractFactory.php b/src/Di/Container/Factory/AbstractFactory.php index a297027..9919b97 100644 --- a/src/Di/Container/Factory/AbstractFactory.php +++ b/src/Di/Container/Factory/AbstractFactory.php @@ -12,8 +12,8 @@ namespace Phoundation\Di\Container\Factory; -use Interop\Container\ContainerInterface; use Phoundation\Config\Config; +use Psr\Container\ContainerInterface; /** * @author Nikola Posa diff --git a/src/Di/Container/Factory/AuraDiFactory.php b/src/Di/Container/Factory/AuraDiFactory.php index acd1566..88f61d1 100644 --- a/src/Di/Container/Factory/AuraDiFactory.php +++ b/src/Di/Container/Factory/AuraDiFactory.php @@ -14,7 +14,7 @@ use Aura\Di\Container; use Aura\Di\ContainerBuilder; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; /** * @author Nikola Posa diff --git a/src/Di/Container/Factory/DiContainerFactoryInterface.php b/src/Di/Container/Factory/DiContainerFactoryInterface.php index bc23c40..850c148 100644 --- a/src/Di/Container/Factory/DiContainerFactoryInterface.php +++ b/src/Di/Container/Factory/DiContainerFactoryInterface.php @@ -12,8 +12,8 @@ namespace Phoundation\Di\Container\Factory; -use Interop\Container\ContainerInterface; use Phoundation\Config\Config; +use Psr\Container\ContainerInterface; /** * @author Nikola Posa diff --git a/src/Di/Container/Factory/PimpleFactory.php b/src/Di/Container/Factory/PimpleFactory.php index 27a2a57..f8bc259 100644 --- a/src/Di/Container/Factory/PimpleFactory.php +++ b/src/Di/Container/Factory/PimpleFactory.php @@ -12,7 +12,7 @@ namespace Phoundation\Di\Container\Factory; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use Xtreamwayz\Pimple\Container; /** diff --git a/src/Di/Container/Factory/ZendServiceManagerFactory.php b/src/Di/Container/Factory/ZendServiceManagerFactory.php index 46420f4..6881461 100644 --- a/src/Di/Container/Factory/ZendServiceManagerFactory.php +++ b/src/Di/Container/Factory/ZendServiceManagerFactory.php @@ -12,7 +12,7 @@ namespace Phoundation\Di\Container\Factory; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use Zend\ServiceManager\ServiceManager; /** diff --git a/tests/Bootstrap/BootstrapTest.php b/tests/Bootstrap/BootstrapTest.php index 71dabf7..eac1850 100644 --- a/tests/Bootstrap/BootstrapTest.php +++ b/tests/Bootstrap/BootstrapTest.php @@ -15,10 +15,10 @@ use PHPUnit\Framework\TestCase; use Phoundation\Bootstrap\Bootstrap; use Phoundation\Config\Loader\StaticConfigLoader; -use Interop\Container\ContainerInterface; use Phoundation\Config\Config; use Phoundation\Di\Container\Factory\DiContainerFactoryInterface; use Phoundation\Di\Container\Factory\ZendServiceManagerFactory; +use Psr\Container\ContainerInterface; use Zend\ServiceManager\ServiceManager; use Phoundation\ErrorHandling\RunnerInterface; use Phoundation\ErrorHandling\WhoopsRunner; diff --git a/tests/Di/Container/Factory/ContainerFactoryTest.php b/tests/Di/Container/Factory/ContainerFactoryTest.php index 45d7df5..bf81ae3 100644 --- a/tests/Di/Container/Factory/ContainerFactoryTest.php +++ b/tests/Di/Container/Factory/ContainerFactoryTest.php @@ -14,10 +14,10 @@ use PHPUnit\Framework\TestCase; use Phoundation\Di\Container\Factory\DiContainerFactoryInterface; -use Interop\Container\ContainerInterface; use Phoundation\Config\Config; use Phoundation\Tests\TestAsset\Service\InMemoryLogger; use Phoundation\Tests\TestAsset\Service\InMemoryLoggerFactory; +use Psr\Container\ContainerInterface; /** * @author Nikola Posa From 283fce944247eef804b15895ef86e1b585995759 Mon Sep 17 00:00:00 2001 From: Dusan Vejin Date: Fri, 23 Jun 2017 21:38:08 +0200 Subject: [PATCH 3/3] Sort deps alphabetically --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1643ce6..41001ac 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ ], "require": { "php": "^7.0", - "psr/log": "^1.0", - "psr/container": "^1.0" + "psr/container": "^1.0", + "psr/log": "^1.0" }, "require-dev": { "phpunit/phpunit": "^5.7 || ^6.0",