Skip to content

Commit

Permalink
Switching from ContainerInterop to PSR-11
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Burns committed Mar 21, 2017
1 parent a51018c commit 9a04bf9
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Slim/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Closure;
use Exception;
use FastRoute\Dispatcher;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use InvalidArgumentException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down
2 changes: 1 addition & 1 deletion Slim/CallableResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Slim;

use RuntimeException;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Slim\Interfaces\CallableResolverInterface;

/**
Expand Down
8 changes: 4 additions & 4 deletions Slim/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
*/
namespace Slim;

use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Psr\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Pimple\Container as PimpleContainer;
use Slim\Exception\ContainerValueNotFoundException;
use Slim\Exception\ContainerException as SlimContainerException;

/**
* Slim's default DI container is Pimple.
*
* Slim\App expects a container that implements Interop\Container\ContainerInterface
* Slim\App expects a container that implements Psr\Container\ContainerInterface
* with these service keys configured and ready for use:
*
* - settings: an array or instance of \ArrayAccess
Expand Down Expand Up @@ -110,7 +110,7 @@ private function registerDefaultServices($userSettings)
* @param string $id Identifier of the entry to look for.
*
* @throws ContainerValueNotFoundException No entry was found for this identifier.
* @throws ContainerException Error while retrieving the entry.
* @throws ContainerExceptionInterface Error while retrieving the entry.
*
* @return mixed Entry.
*/
Expand Down
4 changes: 2 additions & 2 deletions Slim/Exception/ContainerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
namespace Slim\Exception;

use InvalidArgumentException;
use Interop\Container\Exception\ContainerException as InteropContainerException;
use Psr\Container\ContainerExceptionInterface;

/**
* Container Exception
*/
class ContainerException extends InvalidArgumentException implements InteropContainerException
class ContainerException extends InvalidArgumentException implements ContainerExceptionInterface
{

}
4 changes: 2 additions & 2 deletions Slim/Exception/ContainerValueNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
namespace Slim\Exception;

use RuntimeException;
use Interop\Container\Exception\NotFoundException as InteropNotFoundException;
use Psr\Container\NotFoundExceptionInterface;

/**
* Not Found Exception
*/
class ContainerValueNotFoundException extends RuntimeException implements InteropNotFoundException
class ContainerValueNotFoundException extends RuntimeException implements NotFoundExceptionInterface
{

}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"pimple/pimple": "^3.0",
"psr/http-message": "^1.0",
"nikic/fast-route": "^1.0",
"container-interop/container-interop": "^1.1"
"psr/container": "^1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5",
Expand Down
2 changes: 1 addition & 1 deletion tests/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Slim\Tests;

use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Slim\App;
use Slim\Container;
Expand Down
10 changes: 5 additions & 5 deletions tests/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Slim\Tests;

use Slim\Container;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;

class ContainerTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -36,7 +36,7 @@ public function testGet()
/**
* Test `get()` throws error if item does not exist
*
* @expectedException \Interop\Container\Exception\NotFoundException
* @expectedException \Psr\Container\NotFoundExceptionInterface
*/
public function testGetWithValueNotFoundError()
{
Expand All @@ -47,7 +47,7 @@ public function testGetWithValueNotFoundError()
* Test `get()` throws something that is a ContainerExpception - typically a NotFoundException, when there is a DI
* config error
*
* @expectedException \Interop\Container\Exception\ContainerException
* @expectedException \Psr\Container\NotFoundExceptionInterface
*/
public function testGetWithDiConfigErrorThrownAsContainerValueNotFoundException()
{
Expand All @@ -61,10 +61,10 @@ function (ContainerInterface $container) {
}

/**
* Test `get()` recasts \InvalidArgumentException as ContainerInterop-compliant exceptions when an error is present
* Test `get()` recasts \InvalidArgumentException as PSR-11 compliant exceptions when an error is present
* in the DI config
*
* @expectedException \Interop\Container\Exception\ContainerException
* @expectedException \Psr\Container\ContainerExceptionInterface
*/
public function testGetWithDiConfigErrorThrownAsInvalidArgumentException()
{
Expand Down

0 comments on commit 9a04bf9

Please sign in to comment.