Removed use of Interop container

This commit is contained in:
Alejandro Celaya 2019-08-12 18:59:02 +02:00
parent 456765e55b
commit 6720d12ab8
13 changed files with 25 additions and 62 deletions

View File

@ -2,7 +2,7 @@
<?php
declare(strict_types=1);
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application as CliApp;
/** @var ContainerInterface $container */

View File

@ -20,6 +20,7 @@
"cakephp/chronos": "^1.2",
"cocur/slugify": "^3.0",
"doctrine/cache": "^1.6",
"doctrine/dbal": "^2.9",
"doctrine/migrations": "^2.0",
"doctrine/orm": "^2.5",
"endroid/qr-code": "^1.7",

View File

@ -3,7 +3,7 @@ declare(strict_types=1);
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Zend\ServiceManager\ServiceManager;
/** @var ContainerInterface|ServiceManager $container */

View File

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Factory;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Shlinkio\Shlink\Core\Options\AppOptions;
use Symfony\Component\Console\Application as CliApp;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;

View File

@ -3,19 +3,15 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\EventDispatcher\Async;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Swoole\Http\Server as HttpServer;
use Zend\ServiceManager\Factory\DelegatorFactoryInterface;
class TaskRunnerDelegator implements DelegatorFactoryInterface
class TaskRunnerDelegator
{
public function __invoke(
ContainerInterface $container,
$name,
callable $callback,
?array $options = null
): HttpServer {
public function __invoke(ContainerInterface $container, $name, callable $callback): HttpServer
{
/** @var HttpServer $server */
$server = $callback();
$logger = $container->get(LoggerInterface::class);

View File

@ -3,13 +3,12 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\EventDispatcher\Async;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
class TaskRunnerFactory implements FactoryInterface
class TaskRunnerFactory
{
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): TaskRunner
public function __invoke(ContainerInterface $container): TaskRunner
{
$logger = $container->get(LoggerInterface::class);
return new TaskRunner($logger, $container);

View File

@ -3,17 +3,16 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\EventDispatcher\Listener;
use Interop\Container\ContainerInterface;
use Phly\EventDispatcher\ListenerProvider\AttachableListenerProvider;
use Psr\Container\ContainerInterface;
use Swoole\Http\Server as HttpServer;
use Zend\ServiceManager\Factory\FactoryInterface;
use function Phly\EventDispatcher\lazyListener;
use function Shlinkio\Shlink\EventDispatcher\asyncListener;
class ListenerProviderFactory implements FactoryInterface
class ListenerProviderFactory
{
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
public function __invoke(ContainerInterface $container)
{
$config = $container->has('config') ? $container->get('config') : [];
$events = $config['events'] ?? [];

View File

@ -3,8 +3,8 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\EventDispatcher\Async;
use Interop\Container\ContainerInterface;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\EventDispatcher\Async\TaskRunner;
use Shlinkio\Shlink\EventDispatcher\Async\TaskRunnerDelegator;

View File

@ -3,8 +3,8 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\EventDispatcher\Async;
use Interop\Container\ContainerInterface;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use ReflectionObject;
use Shlinkio\Shlink\EventDispatcher\Async\TaskRunner;

View File

@ -3,9 +3,9 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\EventDispatcher\Listener;
use Interop\Container\ContainerInterface;
use Phly\EventDispatcher\ListenerProvider\AttachableListenerProvider;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use ReflectionObject;
use Shlinkio\Shlink\EventDispatcher\Listener\ListenerProviderFactory;
use Swoole\Http\Server as HttpServer;

View File

@ -3,29 +3,13 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\PreviewGenerator\Image;
use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use mikehaertl\wkhtmlto\Image;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
/** @deprecated */
class ImageBuilderFactory implements FactoryInterface
class ImageBuilderFactory
{
/**
* Create an object
*
* @param ContainerInterface $container
* @param string $requestedName
* @param null|array $options
* @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
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
public function __invoke(ContainerInterface $container)
{
return new ImageBuilder($container, ['factories' => [
Image::class => ImageFactory::class,

View File

@ -3,29 +3,13 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\PreviewGenerator\Image;
use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use mikehaertl\wkhtmlto\Image;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
/** @deprecated */
class ImageFactory implements FactoryInterface
class ImageFactory
{
/**
* Create an object
*
* @param ContainerInterface $container
* @param string $requestedName
* @param null|array $options
* @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
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
public function __invoke(ContainerInterface $container, string $requestedName, ?array $options = null)
{
$config = $container->get('config')['wkhtmltopdf'];
$image = new Image($config['images'] ?? null);

View File

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Rest\Authentication;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerInterface;
class AuthenticationPluginManagerFactory
{