Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from container-interop to PSR-11 #3

Merged
merged 3 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": "^7.0",
"container-interop/container-interop": "^1.1",
"psr/container": "^1.0",
"psr/log": "^1.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions src/Bootstrap/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __construct(ConfigLoaderInterface $configLoader, DiContainerFact
$this->diContainerFactory = $diContainerFactory;
}

public function __invoke()
public function __invoke() : ContainerInterface
{
$this->loadConfig();
$this->buildDiContainer();
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Di/Container/Factory/AbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

namespace Phoundation\Di\Container\Factory;

use Interop\Container\ContainerInterface;
use Phoundation\Config\Config;
use Psr\Container\ContainerInterface;

/**
* @author Nikola Posa <[email protected]>
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions src/Di/Container/Factory/AuraDiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use Aura\Di\Container;
use Aura\Di\ContainerBuilder;
use Psr\Container\ContainerInterface;

/**
* @author Nikola Posa <[email protected]>
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Di/Container/Factory/DiContainerFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

namespace Phoundation\Di\Container\Factory;

use Interop\Container\ContainerInterface;
use Phoundation\Config\Config;
use Psr\Container\ContainerInterface;

/**
* @author Nikola Posa <[email protected]>
Expand Down
5 changes: 3 additions & 2 deletions src/Di/Container/Factory/PimpleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Phoundation\Di\Container\Factory;

use Psr\Container\ContainerInterface;
use Xtreamwayz\Pimple\Container;

/**
Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/Di/Container/Factory/ZendServiceManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@

namespace Phoundation\Di\Container\Factory;

use Psr\Container\ContainerInterface;
use Zend\ServiceManager\ServiceManager;

/**
* @author Nikola Posa <[email protected]>
*/
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 */

Expand Down
2 changes: 1 addition & 1 deletion tests/Bootstrap/BootstrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Di/Container/Factory/ContainerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand Down