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 <?php
declare(strict_types=1); declare(strict_types=1);
use Interop\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application as CliApp; use Symfony\Component\Console\Application as CliApp;
/** @var ContainerInterface $container */ /** @var ContainerInterface $container */

View File

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

View File

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

View File

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

View File

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

View File

@ -3,13 +3,12 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\EventDispatcher\Async; namespace Shlinkio\Shlink\EventDispatcher\Async;
use Interop\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface; 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); $logger = $container->get(LoggerInterface::class);
return new TaskRunner($logger, $container); return new TaskRunner($logger, $container);

View File

@ -3,17 +3,16 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\EventDispatcher\Listener; namespace Shlinkio\Shlink\EventDispatcher\Listener;
use Interop\Container\ContainerInterface;
use Phly\EventDispatcher\ListenerProvider\AttachableListenerProvider; use Phly\EventDispatcher\ListenerProvider\AttachableListenerProvider;
use Psr\Container\ContainerInterface;
use Swoole\Http\Server as HttpServer; use Swoole\Http\Server as HttpServer;
use Zend\ServiceManager\Factory\FactoryInterface;
use function Phly\EventDispatcher\lazyListener; use function Phly\EventDispatcher\lazyListener;
use function Shlinkio\Shlink\EventDispatcher\asyncListener; 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') : []; $config = $container->has('config') ? $container->get('config') : [];
$events = $config['events'] ?? []; $events = $config['events'] ?? [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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