Improved coding styles

This commit is contained in:
Alejandro Celaya 2017-10-12 10:13:20 +02:00
parent fbeb959317
commit c422a14c5c
219 changed files with 473 additions and 26 deletions

View File

@ -46,6 +46,7 @@
"require-dev": { "require-dev": {
"filp/whoops": "^2.0", "filp/whoops": "^2.0",
"phpunit/phpunit": "^6.0", "phpunit/phpunit": "^6.0",
"slevomat/coding-standard": "^4.0",
"squizlabs/php_codesniffer": "^3.1", "squizlabs/php_codesniffer": "^3.1",
"symfony/var-dumper": "^3.0", "symfony/var-dumper": "^3.0",
"vlucas/phpdotenv": "^2.2", "vlucas/phpdotenv": "^2.2",

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;
return [ return [

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
use Shlinkio\Shlink\Common\Factory\EmptyResponseImplicitOptionsMiddlewareFactory; use Shlinkio\Shlink\Common\Factory\EmptyResponseImplicitOptionsMiddlewareFactory;
use Zend\Expressive; use Zend\Expressive;
use Zend\Expressive\Container; use Zend\Expressive\Container;
use Zend\Expressive\Helper;
use Zend\Expressive\Middleware; use Zend\Expressive\Middleware;
use Zend\Expressive\Plates; use Zend\Expressive\Plates;
use Zend\Expressive\Router; use Zend\Expressive\Router;
use Zend\Expressive\Template; use Zend\Expressive\Template;
use Zend\Expressive\Helper;
use Zend\ServiceManager\Factory\InvokableFactory; use Zend\ServiceManager\Factory\InvokableFactory;
use Zend\Stratigility\Middleware\ErrorHandler; use Zend\Stratigility\Middleware\ErrorHandler;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;
return [ return [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger; use Monolog\Logger;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware; use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware;
use Shlinkio\Shlink\Rest\Middleware\BodyParserMiddleware; use Shlinkio\Shlink\Rest\Middleware\BodyParserMiddleware;
use Shlinkio\Shlink\Rest\Middleware\CheckAuthenticationMiddleware; use Shlinkio\Shlink\Rest\Middleware\CheckAuthenticationMiddleware;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
return [ return [
'phpwkhtmltopdf' => [ 'phpwkhtmltopdf' => [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
return [ return [
'preview_generation' => [ 'preview_generation' => [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Zend\Expressive\Router\FastRouteRouter; use Zend\Expressive\Router\FastRouteRouter;
return [ return [

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
return [ return [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;
return [ return [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;
use Shlinkio\Shlink\Core\Service\UrlShortener; use Shlinkio\Shlink\Core\Service\UrlShortener;

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
return [ return [

View File

@ -1,4 +1,6 @@
<?php <?php
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 Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Acelaya\ExpressiveErrorHandler; use Acelaya\ExpressiveErrorHandler;
use Shlinkio\Shlink\CLI; use Shlinkio\Shlink\CLI;
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Dotenv\Dotenv; use Dotenv\Dotenv;
use Zend\ServiceManager\ServiceManager; use Zend\ServiceManager\ServiceManager;

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\CLI\Command; use Shlinkio\Shlink\CLI\Command;
use Shlinkio\Shlink\Common; use Shlinkio\Shlink\Common;
@ -22,7 +24,7 @@ return [
Command\Tag\CreateTagCommand::class, Command\Tag\CreateTagCommand::class,
Command\Tag\RenameTagCommand::class, Command\Tag\RenameTagCommand::class,
Command\Tag\DeleteTagsCommand::class, Command\Tag\DeleteTagsCommand::class,
] ],
], ],
]; ];

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
use Shlinkio\Shlink\CLI\Command; use Shlinkio\Shlink\CLI\Command;
use Shlinkio\Shlink\CLI\Factory\ApplicationFactory; use Shlinkio\Shlink\CLI\Factory\ApplicationFactory;
@ -46,12 +47,12 @@ return [
Command\Shortcode\GeneratePreviewCommand::class => [ Command\Shortcode\GeneratePreviewCommand::class => [
Service\ShortUrlService::class, Service\ShortUrlService::class,
PreviewGenerator::class, PreviewGenerator::class,
'translator' 'translator',
], ],
Command\Visit\ProcessVisitsCommand::class => [ Command\Visit\ProcessVisitsCommand::class => [
Service\VisitService::class, Service\VisitService::class,
IpLocationResolver::class, IpLocationResolver::class,
'translator' 'translator',
], ],
Command\Config\GenerateCharsetCommand::class => ['translator'], Command\Config\GenerateCharsetCommand::class => ['translator'],
Command\Config\GenerateSecretCommand::class => ['translator'], Command\Config\GenerateSecretCommand::class => ['translator'],

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
return [ return [
'translator' => [ 'translator' => [

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Api; namespace Shlinkio\Shlink\CLI\Command\Api;
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface; use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Api; namespace Shlinkio\Shlink\CLI\Command\Api;
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface; use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Api; namespace Shlinkio\Shlink\CLI\Command\Api;
use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Entity\ApiKey;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Config; namespace Shlinkio\Shlink\CLI\Command\Config;
use Shlinkio\Shlink\Core\Service\UrlShortener; use Shlinkio\Shlink\Core\Service\UrlShortener;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Config; namespace Shlinkio\Shlink\CLI\Command\Config;
use Shlinkio\Shlink\Common\Util\StringUtilsTrait; use Shlinkio\Shlink\Common\Util\StringUtilsTrait;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Install; namespace Shlinkio\Shlink\CLI\Command\Install;
use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManagerInterface; use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManagerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Shortcode; namespace Shlinkio\Shlink\CLI\Command\Shortcode;
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException; use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Shortcode; namespace Shlinkio\Shlink\CLI\Command\Shortcode;
use Shlinkio\Shlink\Core\Exception\InvalidUrlException; use Shlinkio\Shlink\Core\Exception\InvalidUrlException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Shortcode; namespace Shlinkio\Shlink\CLI\Command\Shortcode;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Shortcode; namespace Shlinkio\Shlink\CLI\Command\Shortcode;
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter; use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Shortcode; namespace Shlinkio\Shlink\CLI\Command\Shortcode;
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException; use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Tag; namespace Shlinkio\Shlink\CLI\Command\Tag;
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Tag; namespace Shlinkio\Shlink\CLI\Command\Tag;
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Tag; namespace Shlinkio\Shlink\CLI\Command\Tag;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Tag; namespace Shlinkio\Shlink\CLI\Command\Tag;
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException; use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Command\Visit; namespace Shlinkio\Shlink\CLI\Command\Visit;
use Shlinkio\Shlink\Common\Exception\WrongIpException; use Shlinkio\Shlink\Common\Exception\WrongIpException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI; namespace Shlinkio\Shlink\CLI;
use Zend\Config\Factory; use Zend\Config\Factory;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Factory; namespace Shlinkio\Shlink\CLI\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Factory; namespace Shlinkio\Shlink\CLI\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install; namespace Shlinkio\Shlink\CLI\Install;
use Shlinkio\Shlink\CLI\Install\Plugin\ConfigCustomizerPluginInterface; use Shlinkio\Shlink\CLI\Install\Plugin\ConfigCustomizerPluginInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install; namespace Shlinkio\Shlink\CLI\Install;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Exception\RuntimeException;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Acelaya\ZsmAnnotatedServices\Annotation as DI; use Acelaya\ZsmAnnotatedServices\Annotation as DI;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin\Factory; namespace Shlinkio\Shlink\CLI\Install\Plugin\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin; namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
@ -42,7 +44,7 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
'Character set for generated short codes (leave empty to autogenerate one)', 'Character set for generated short codes (leave empty to autogenerate one)',
null, null,
true true
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS) ) ?: str_shuffle(UrlShortener::DEFAULT_CHARS),
]); ]);
} }
} }

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Model; namespace Shlinkio\Shlink\CLI\Model;
use Zend\Stdlib\ArraySerializableInterface; use Zend\Stdlib\ArraySerializableInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Api; namespace ShlinkioTest\Shlink\CLI\Command\Api;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Api; namespace ShlinkioTest\Shlink\CLI\Command\Api;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Api; namespace ShlinkioTest\Shlink\CLI\Command\Api;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Config; namespace ShlinkioTest\Shlink\CLI\Command\Config;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Install; namespace ShlinkioTest\Shlink\CLI\Command\Install;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode; namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@ -63,7 +65,7 @@ class GeneratePreviewCommandTest extends TestCase
$this->previewGenerator->generatePreview('http://baz.com/something')->shouldBeCalledTimes(1); $this->previewGenerator->generatePreview('http://baz.com/something')->shouldBeCalledTimes(1);
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'shortcode:process-previews' 'command' => 'shortcode:process-previews',
]); ]);
} }
@ -83,7 +85,7 @@ class GeneratePreviewCommandTest extends TestCase
->shouldBeCalledTimes(count($items)); ->shouldBeCalledTimes(count($items));
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'shortcode:process-previews' 'command' => 'shortcode:process-previews',
]); ]);
$output = $this->commandTester->getDisplay(); $output = $this->commandTester->getDisplay();
$this->assertEquals(count($items), substr_count($output, 'Error')); $this->assertEquals(count($items), substr_count($output, 'Error'));

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode; namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@ -27,7 +29,7 @@ class GenerateShortcodeCommandTest extends TestCase
$this->urlShortener = $this->prophesize(UrlShortener::class); $this->urlShortener = $this->prophesize(UrlShortener::class);
$command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), [ $command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), [
'schema' => 'http', 'schema' => 'http',
'hostname' => 'foo.com' 'hostname' => 'foo.com',
]); ]);
$app = new Application(); $app = new Application();
$app->add($command); $app->add($command);
@ -44,7 +46,7 @@ class GenerateShortcodeCommandTest extends TestCase
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'shortcode:generate', 'command' => 'shortcode:generate',
'longUrl' => 'http://domain.com/foo/bar' 'longUrl' => 'http://domain.com/foo/bar',
]); ]);
$output = $this->commandTester->getDisplay(); $output = $this->commandTester->getDisplay();
$this->assertTrue(strpos($output, 'http://foo.com/abc123') > 0); $this->assertTrue(strpos($output, 'http://foo.com/abc123') > 0);
@ -60,7 +62,7 @@ class GenerateShortcodeCommandTest extends TestCase
$this->commandTester->execute([ $this->commandTester->execute([
'command' => 'shortcode:generate', 'command' => 'shortcode:generate',
'longUrl' => 'http://domain.com/invalid' 'longUrl' => 'http://domain.com/invalid',
]); ]);
$output = $this->commandTester->getDisplay(); $output = $this->commandTester->getDisplay();
$this->assertTrue( $this->assertTrue(

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode; namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode; namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode; namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,10 +1,12 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand; use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Visit; namespace ShlinkioTest\Shlink\CLI\Command\Visit;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI; namespace ShlinkioTest\Shlink\CLI;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Factory; namespace ShlinkioTest\Shlink\CLI\Factory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Factory; namespace ShlinkioTest\Shlink\CLI\Factory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Install\Plugin; namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Install\Plugin; namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Install\Plugin\Factory; namespace ShlinkioTest\Shlink\CLI\Install\Plugin\Factory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Install\Plugin; namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Install\Plugin; namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\Cache;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common; namespace Shlinkio\Shlink\Common;
/** /**

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common; namespace Shlinkio\Shlink\Common;
use Zend\Config\Factory; use Zend\Config\Factory;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Entity; namespace Shlinkio\Shlink\Common\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception; namespace Shlinkio\Shlink\Common\Exception;
interface ExceptionInterface interface ExceptionInterface

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception; namespace Shlinkio\Shlink\Common\Exception;
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception; namespace Shlinkio\Shlink\Common\Exception;
class PreviewGenerationException extends RuntimeException class PreviewGenerationException extends RuntimeException

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception; namespace Shlinkio\Shlink\Common\Exception;
class RuntimeException extends \RuntimeException implements ExceptionInterface class RuntimeException extends \RuntimeException implements ExceptionInterface

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception; namespace Shlinkio\Shlink\Common\Exception;
class WrongIpException extends RuntimeException class WrongIpException extends RuntimeException

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Doctrine\Common\Cache; use Doctrine\Common\Cache;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Cache\ArrayCache;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Cascade\Cascade; use Cascade\Cascade;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Factory; namespace Shlinkio\Shlink\Common\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Image; namespace Shlinkio\Shlink\Common\Image;
use mikehaertl\wkhtmlto\Image; use mikehaertl\wkhtmlto\Image;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Image; namespace Shlinkio\Shlink\Common\Image;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Image; namespace Shlinkio\Shlink\Common\Image;
use Zend\ServiceManager\ServiceLocatorInterface; use Zend\ServiceManager\ServiceLocatorInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Image; namespace Shlinkio\Shlink\Common\Image;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Middleware; namespace Shlinkio\Shlink\Common\Middleware;
use Interop\Http\ServerMiddleware\DelegateInterface; use Interop\Http\ServerMiddleware\DelegateInterface;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Paginator\Adapter; namespace Shlinkio\Shlink\Common\Paginator\Adapter;
use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface; use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface;
@ -32,7 +34,7 @@ class PaginableRepositoryAdapter implements AdapterInterface
$orderBy = null $orderBy = null
) { ) {
$this->paginableRepository = $paginableRepository; $this->paginableRepository = $paginableRepository;
$this->searchTerm = trim(strip_tags($searchTerm)); $this->searchTerm = $searchTerm !== null ? trim(strip_tags($searchTerm)) : null;
$this->orderBy = $orderBy; $this->orderBy = $orderBy;
$this->tags = $tags; $this->tags = $tags;
} }

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Paginator\Util; namespace Shlinkio\Shlink\Common\Paginator\Util;
use Zend\Paginator\Paginator; use Zend\Paginator\Paginator;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Repository; namespace Shlinkio\Shlink\Common\Repository;
interface PaginableRepositoryInterface interface PaginableRepositoryInterface

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Response; namespace Shlinkio\Shlink\Common\Response;
use Endroid\QrCode\QrCode; use Endroid\QrCode\QrCode;

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Service; namespace Shlinkio\Shlink\Common\Service;
use GuzzleHttp\Client; use GuzzleHttp\Client;
@ -27,7 +29,7 @@ class IpLocationResolver implements IpLocationResolverInterface
{ {
try { try {
$response = $this->httpClient->get(sprintf(self::SERVICE_PATTERN, $ipAddress)); $response = $this->httpClient->get(sprintf(self::SERVICE_PATTERN, $ipAddress));
return json_decode($response->getBody(), true); return json_decode((string) $response->getBody(), true);
} catch (GuzzleException $e) { } catch (GuzzleException $e) {
throw WrongIpException::fromIpAddress($ipAddress, $e); throw WrongIpException::fromIpAddress($ipAddress, $e);
} }

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Service; namespace Shlinkio\Shlink\Common\Service;
interface IpLocationResolverInterface interface IpLocationResolverInterface

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Service; namespace Shlinkio\Shlink\Common\Service;
use mikehaertl\wkhtmlto\Image; use mikehaertl\wkhtmlto\Image;

Some files were not shown because too many files have changed in this diff Show More