Skip to content

Commit

Permalink
Merge 23d4594 into 7e918bd
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Apr 29, 2017
2 parents 7e918bd + 23d4594 commit 1b5971a
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 36 deletions.
3 changes: 0 additions & 3 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
\Psr\Container\ContainerInterface::get('') => [
"" == "@",
],
\Interop\Container\ContainerInterface::get('') => [
"" == "@",
],
\DI\Container::get('') => [
"" == "@",
],
Expand Down
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
},
"require": {
"php": ">=7.0.0",
"container-interop/container-interop": "~1.2",
"psr/container": "~1.0",
"psr/container": "^1.0",
"psr/simple-cache": "^1.0",
"php-di/invoker": "^1.3.2",
"php-di/invoker": "^2.0",
"php-di/phpdoc-reader": "^2.0.1"
},
"require-dev": {
Expand All @@ -41,7 +40,6 @@
"mnapoli/php-di": "*"
},
"provide": {
"container-interop/container-interop-implementation": "^1.0",
"psr/container-implementation": "^1.0"
},
"suggest": {
Expand Down
3 changes: 1 addition & 2 deletions src/DI/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use DI\Invoker\DefinitionParameterResolver;
use DI\Proxy\ProxyFactory;
use Exception;
use Interop\Container\ContainerInterface as InteropContainerInterface;
use InvalidArgumentException;
use Invoker\Invoker;
use Invoker\ParameterResolver\AssociativeArrayResolver;
Expand All @@ -33,7 +32,7 @@
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class Container implements ContainerInterface, InteropContainerInterface, FactoryInterface, \DI\InvokerInterface
class Container implements ContainerInterface, FactoryInterface, \DI\InvokerInterface
{
/**
* Map of entries with Singleton scope that are already resolved.
Expand Down
4 changes: 2 additions & 2 deletions src/DI/DependencyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace DI;

use Interop\Container\Exception\ContainerException;
use Psr\Container\ContainerExceptionInterface;

/**
* Exception for the Container.
*/
class DependencyException extends \Exception implements ContainerException
class DependencyException extends \Exception implements ContainerExceptionInterface
{
}
3 changes: 1 addition & 2 deletions src/DI/Invoker/FactoryParameterResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public function getParameters(
continue;
}

if ($parameterClass->name === 'Interop\Container\ContainerInterface'
|| $parameterClass->name === 'Psr\Container\ContainerInterface') {
if ($parameterClass->name === 'Psr\Container\ContainerInterface') {
$resolvedParameters[$index] = $this->container;
} elseif ($parameterClass->name === 'DI\Factory\RequestedEntry') {
// By convention the second parameter is the definition
Expand Down
4 changes: 2 additions & 2 deletions src/DI/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace DI;

use Interop\Container\Exception\NotFoundException as BaseNotFoundException;
use Psr\Container\NotFoundExceptionInterface;

/**
* Exception thrown when a class or a value is not found in the container.
*/
class NotFoundException extends \Exception implements BaseNotFoundException
class NotFoundException extends \Exception implements NotFoundExceptionInterface
{
}
4 changes: 2 additions & 2 deletions tests/IntegrationTest/Definitions/FactoryDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public function test_container_and_requested_entry_get_injected_in_arbitrary_pos
$this->assertInstanceOf(ContainerInterface::class, $factory[2]);
}

public function test_interop_container_get_injected_in_arbitrary_position_via_typehint()
public function test_container_get_injected_in_arbitrary_position_via_typehint()
{
$container = $this->createContainer([
'factory' => function (\stdClass $stdClass, \Interop\Container\ContainerInterface $c) {
'factory' => function (\stdClass $stdClass, ContainerInterface $c) {
return [$stdClass, $c];
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ public function should_be_able_to_resolve_defined_env_variables()

/**
* @test
*
* @see https://github.com/container-interop/container-interop/issues/37
*/
public function should_be_able_to_resolve_undefined_env_variables()
{
// See https://github.com/container-interop/container-interop/issues/37
$this->assertTrue($this->resolver->isResolvable($this->undefinedDefinition));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@ public function setUp()
$this->requestedEntry = $this->easyMock(RequestedEntry::class);
}

/**
* @test
*/
public function should_resolve_interop_container()
{
$callable = function (\Interop\Container\ContainerInterface $c) {
};
$reflection = new \ReflectionFunction($callable);

$parameters = $this->resolver->getParameters($reflection, [$this->container, $this->requestedEntry], []);

$this->assertCount(1, $parameters);
$this->assertSame($this->container, $parameters[0]);
}

/**
* @test
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/UnitTest/Definition/Resolver/FactoryResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use DI\Test\UnitTest\Definition\Resolver\Fixture\FixtureClass;
use DI\Test\UnitTest\Definition\Resolver\Fixture\NoConstructor;
use EasyMock\EasyMock;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;

/**
* @covers \DI\Definition\Resolver\FactoryResolver
Expand Down
3 changes: 1 addition & 2 deletions website/home_container.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<div class="col-md-6">
<h4>Get & Has</h4>
<p>
PHP-DI is compliant with <a href="https://github.com/container-interop/container-interop">container-interop</a>
and <a href="http://www.php-fig.org/psr/">PSR-11</a>:
PHP-DI is compliant with <a href="http://www.php-fig.org/psr/">PSR-11</a>:
</p>
<pre><code class="php">$container->get($name);
$container->has($name);</code></pre>
Expand Down

0 comments on commit 1b5971a

Please sign in to comment.