Skip to content

Commit

Permalink
Merge pull request #2 from dutekvejin/improvement/strict-typing
Browse files Browse the repository at this point in the history
Missing strict types
  • Loading branch information
nikolaposa authored Jun 23, 2017
2 parents 8c6b84b + 5a8ee38 commit 26ae3ea
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Bootstrap/Bootstrap.php
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions src/Di/Container/Factory/AbstractFactory.php
Original file line number Diff line number Diff line change
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 Interop\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
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 Interop\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 Interop\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

0 comments on commit 26ae3ea

Please sign in to comment.