Skip to content

Commit

Permalink
feature: replace container-interop/container-interop
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Bösing <[email protected]>
  • Loading branch information
boesing committed Apr 4, 2022
1 parent 6f256bc commit 0732d65
Show file tree
Hide file tree
Showing 49 changed files with 119 additions and 272 deletions.
2 changes: 1 addition & 1 deletion benchmarks/BenchAsset/AbstractFactoryFoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace LaminasBench\ServiceManager\BenchAsset;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
use Psr\Container\ContainerInterface;

class AbstractFactoryFoo implements AbstractFactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/BenchAsset/FactoryFoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace LaminasBench\ServiceManager\BenchAsset;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;

class FactoryFoo implements FactoryInterface
{
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,22 @@
"vimeo/psalm": "^4.8"
},
"provide": {
"container-interop/container-interop-implementation": "^1.2",
"psr/container-implementation": "^1.0"
},
"conflict": {
"container-interop/container-interop": "<1.2.0",
"laminas/laminas-code": "<3.3.1",
"zendframework/zend-code": "<3.3.1",
"zendframework/zend-servicemanager": "*",
"laminas/laminas-code": "<3.3.1"
"zendframework/zend-servicemanager": "*"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services"
},
"autoload": {
"psr-4": {
"Laminas\\ServiceManager\\": "src/"
}
},
"files": ["src/autoload.php"]
},
"autoload-dev": {
"files": [
Expand All @@ -91,5 +92,8 @@
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"static-analysis" : "psalm --shepherd --stats"
},
"replace": {
"container-interop/container-interop": "^1.2.0"
}
}
40 changes: 2 additions & 38 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/AbstractFactory/ConfigAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace Laminas\ServiceManager\AbstractFactory;

use ArrayObject;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
use Psr\Container\ContainerInterface;

use function array_key_exists;
use function array_map;
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractFactory/ReflectionBasedAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Laminas\ServiceManager\AbstractFactory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
use Psr\Container\ContainerInterface;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionParameter;
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
*
* - rename the method `canCreateServiceWithName()` to `canCreate()`, and:
* - rename the `$serviceLocator` argument to `$container`, and change the
* typehint to `Interop\Container\ContainerInterface`
* typehint to `Psr\Container\ContainerInterface`
* - merge the `$name` and `$requestedName` arguments
* - rename the method `createServiceWithName()` to `__invoke()`, and:
* - rename the `$serviceLocator` argument to `$container`, and change the
* typehint to `Interop\Container\ContainerInterface`
* typehint to `Psr\Container\ContainerInterface`
* - merge the `$name` and `$requestedName` arguments
* - add the optional `array $options = null` argument.
* - create a `canCreateServiceWithName()` method as defined in this interface, and have it
Expand Down
13 changes: 1 addition & 12 deletions src/AbstractPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Laminas\ServiceManager;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Exception\ContainerModificationsNotAllowedException;
use Laminas\ServiceManager\Exception\InvalidServiceException;
use Psr\Container\ContainerInterface;
use Psr\Container\ContainerInterface as PsrContainerInterface;

use function class_exists;
Expand Down Expand Up @@ -64,17 +64,6 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
*/
public function __construct($configInstanceOrParentLocator = null, array $config = [])
{
if (
$configInstanceOrParentLocator instanceof PsrContainerInterface
&& ! $configInstanceOrParentLocator instanceof ContainerInterface
) {
/**
* {@see \Laminas\ServiceManager\Factory\FactoryInterface} typehints
* against interop container and as such cannot accept non-interop
* psr container. Decorate it as interop.
*/
$configInstanceOrParentLocator = new PsrContainerDecorator($configInstanceOrParentLocator);
}
if (
null !== $configInstanceOrParentLocator
&& ! $configInstanceOrParentLocator instanceof ConfigInterface
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Laminas\ServiceManager;

use ArrayAccess;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;

/**
* @see ContainerInterface
Expand Down
2 changes: 1 addition & 1 deletion src/DelegatorFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* - rename the method `createDelegatorWithName()` to `__invoke()`, and:
* - rename the `$serviceLocator` argument to `$container`, and change the
* typehint to `Interop\Container\ContainerInterface`
* typehint to `Psr\Container\ContainerInterface`
* - merge the `$name` and `$requestedName` arguments
* - add the `callable` typehint to the `$callback` argument
* - add the optional `array $options = null` argument as a final argument
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Laminas\ServiceManager\Exception;

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

/**
* Base exception for all Laminas\ServiceManager exceptions.
*/
interface ExceptionInterface extends ContainerException
interface ExceptionInterface extends ContainerExceptionInterface
{
}
2 changes: 0 additions & 2 deletions src/Exception/ServiceNotCreatedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace Laminas\ServiceManager\Exception;

use Interop\Container\Exception\ContainerException;
use RuntimeException as SplRuntimeException;

/**
* This exception is thrown when the service locator do not manage to create
* the service (factory that has an error...)
*/
class ServiceNotCreatedException extends SplRuntimeException implements
ContainerException,
ExceptionInterface
{
}
4 changes: 2 additions & 2 deletions src/Exception/ServiceNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace Laminas\ServiceManager\Exception;

use Interop\Container\Exception\NotFoundException;
use InvalidArgumentException as SplInvalidArgumentException;
use Psr\Container\NotFoundExceptionInterface;

/**
* This exception is thrown when the service locator do not manage to find a
* valid factory to create a service
*/
class ServiceNotFoundException extends SplInvalidArgumentException implements
ExceptionInterface,
NotFoundException
NotFoundExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Factory/AbstractFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Laminas\ServiceManager\Factory;

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

/**
* Interface for an abstract factory.
Expand Down
6 changes: 3 additions & 3 deletions src/Factory/DelegatorFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Laminas\ServiceManager\Factory;

use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;

/**
* Delegator factory interface.
Expand All @@ -28,7 +28,7 @@ interface DelegatorFactoryInterface
* @return object
* @throws ServiceNotFoundException If unable to resolve the service.
* @throws ServiceNotCreatedException If an exception is raised when creating a service.
* @throws ContainerException If any other error occurs.
* @throws ContainerExceptionInterface If any other error occurs.
*/
public function __invoke(ContainerInterface $container, $name, callable $callback, ?array $options = null);
}
6 changes: 3 additions & 3 deletions src/Factory/FactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Laminas\ServiceManager\Factory;

use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;

/**
* Interface for a factory
Expand All @@ -27,7 +27,7 @@ interface FactoryInterface
* @return object
* @throws ServiceNotFoundException If unable to resolve the service.
* @throws ServiceNotCreatedException If an exception is raised when creating a service.
* @throws ContainerException If any other error occurs.
* @throws ContainerExceptionInterface If any other error occurs.
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null);
}
2 changes: 1 addition & 1 deletion src/Factory/InvokableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Laminas\ServiceManager\Factory;

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

/**
* Factory for instantiating classes with no dependencies or which accept a single array.
Expand Down
2 changes: 1 addition & 1 deletion src/FactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* - rename the method `createService()` to `__invoke()`, and:
* - rename the `$serviceLocator` argument to `$container`, and change the
* typehint to `Interop\Container\ContainerInterface`
* typehint to `Psr\Container\ContainerInterface`
* - add the `$requestedName` as a second argument
* - add the optional `array $options = null` argument as a final argument
* - create a `createService()` method as defined in this interface, and have it
Expand Down
2 changes: 1 addition & 1 deletion src/Initializer/InitializerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Laminas\ServiceManager\Initializer;

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

/**
* Interface for an initializer
Expand Down
2 changes: 1 addition & 1 deletion src/InitializerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* - rename the method `initialize()` to `__invoke()`, and:
* - rename the `$serviceLocator` argument to `$container`, and change the
* typehint to `Interop\Container\ContainerInterface`
* typehint to `Psr\Container\ContainerInterface`
* - swap the order of the arguments (so that `$instance` comes second)
* - create an `initialize()` method as defined in this interface, and have it
* proxy to `__invoke()`, passing the arguments in the new order.
Expand Down
4 changes: 2 additions & 2 deletions src/PluginManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Laminas\ServiceManager;

use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\Exception\InvalidServiceException;
use Psr\Container\ContainerExceptionInterface;

/**
* Interface for a plugin manager
Expand All @@ -21,7 +21,7 @@ interface PluginManagerInterface extends ServiceLocatorInterface
* @return void
* @throws InvalidServiceException If created instance does not respect the
* constraint on type imposed by the plugin manager.
* @throws ContainerException If any other error occurs.
* @throws ContainerExceptionInterface If any other error occurs.
*/
public function validate($instance);
}
2 changes: 1 addition & 1 deletion src/Proxy/LazyServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Laminas\ServiceManager\Proxy;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Exception;
use Laminas\ServiceManager\Factory\DelegatorFactoryInterface;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\Proxy\LazyLoadingInterface;
use ProxyManager\Proxy\VirtualProxyInterface;
use Psr\Container\ContainerInterface;

use function sprintf;

Expand Down
Loading

0 comments on commit 0732d65

Please sign in to comment.