diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index cf4454a..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,4 +0,0 @@ -# for php-coveralls -service_name: travis-ci -coverage_clover: coverage.xml -json_path: coverage.json \ No newline at end of file diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 023e2ee..0000000 --- a/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -.gitattributes export-ignore -.gitignore export-ignore -/.travis.yml export-ignore -/.coveralls.yml export-ignore -/tests export-ignore -/docs export-ignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..54107a5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Tests + +on: [ push, pull_request ] + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + coverage: pcov + + - name: Composer install + run: composer install --dev --no-progress + + - name: Check coding standard + run: vendor/bin/phpcs --standard=PSR12 ./src ./tests + + - name: Check phpstan + run: vendor/bin/phpstan + + - name: Check tests + run: vendor/bin/tester tests -C --coverage coverage.xml --coverage-src ./src + + - name: Upload coverage + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls + php-coveralls --coverage_clover=coverage.xml --json_path=upload.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 15a4a9c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -install: - - composer install --no-interaction --prefer-dist - -script: - - php vendor/bin/phpstan analyse ./src ./tests --level max - - php vendor/bin/phpcs --standard=PSR12 ./src ./tests - - php vendor/bin/tester ./tests -p phpdbg --coverage ./coverage.xml --coverage-src ./src - -after_script: - # Report Code Coverage - - > - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar - && php coveralls.phar --verbose --config .coveralls.yml \ No newline at end of file diff --git a/Makefile b/Makefile index b440e59..2e7c277 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ test: rm -rf tests/tmp/cache - php vendor/bin/phpstan analyse ./src ./tests --level max + php vendor/bin/phpstan php vendor/bin/phpcs --standard=PSR12 ./src ./tests php vendor/bin/tester ./tests diff --git a/composer.json b/composer.json index 684a4eb..c5000d7 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": "^7.1", + "php": "^8.0", "ext-json": "*", "nette/di": "^3.0", "php-http/client-common": "^2.0", @@ -26,7 +26,7 @@ "php-http/message-factory": "^1.0" }, "require-dev": { - "freezy-bee/nette-caching-psr6": "^1.1", + "freezy-bee/nette-caching-psr6": "^2.0", "mockery/mockery": "^1.1", "nette/application": "^3.0", "nette/bootstrap": "^3.0", @@ -36,9 +36,9 @@ "php-http/curl-client": "^2.0", "php-http/guzzle7-adapter": "^1.0", "php-http/logger-plugin": "^1.0", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^1.8", "squizlabs/php_codesniffer": "^3.0", - "symfony/cache": "^4.0 || ^5.0", + "symfony/cache": "^6.0", "tracy/tracy": "^2.6" }, "autoload": { diff --git a/phpstan.neon b/phpstan.neon index 9d52fd9..ae45ff9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,2 +1,7 @@ parameters: - checkMissingIterableValueType: false + level: 8 + paths: + - src + - tests + + checkUninitializedProperties: true diff --git a/src/ClientFactory/ClientFactory.php b/src/ClientFactory/ClientFactory.php index 62fc6b6..b31193f 100644 --- a/src/ClientFactory/ClientFactory.php +++ b/src/ClientFactory/ClientFactory.php @@ -12,9 +12,7 @@ interface ClientFactory { /** - * Input an array of configuration to be able to create a HttpClient. - * @param array $config - * @return HttpClient + * @param array $config */ public function createClient(array $config = []): HttpClient; } diff --git a/src/ClientFactory/CurlFactory.php b/src/ClientFactory/CurlFactory.php index 775ae3c..602e3c0 100644 --- a/src/ClientFactory/CurlFactory.php +++ b/src/ClientFactory/CurlFactory.php @@ -13,10 +13,6 @@ */ class CurlFactory implements ClientFactory { - /** - * {@inheritdoc} - * @throws \LogicException - */ public function createClient(array $config = []): HttpClient { if (!class_exists(Client::class)) { diff --git a/src/ClientFactory/Guzzle7Factory.php b/src/ClientFactory/Guzzle7Factory.php index 0fb2cbb..55d40da 100644 --- a/src/ClientFactory/Guzzle7Factory.php +++ b/src/ClientFactory/Guzzle7Factory.php @@ -13,10 +13,6 @@ */ class Guzzle7Factory implements ClientFactory { - /** - * {@inheritdoc} - * @throws LogicException - */ public function createClient(array $config = []): HttpClient { if (!class_exists(Client::class)) { diff --git a/src/ClientFactory/PluginClientFactory.php b/src/ClientFactory/PluginClientFactory.php index f087ad9..b5faad0 100644 --- a/src/ClientFactory/PluginClientFactory.php +++ b/src/ClientFactory/PluginClientFactory.php @@ -17,10 +17,8 @@ class PluginClientFactory { /** * @param Plugin[] $plugins - * @param ClientFactory $factory - * @param array $config config to the client factory - * @param array $pluginClientOptions config forwarded to the PluginClient - * @param bool $debugMode + * @param array $config config to the client factory + * @param array $pluginClientOptions config forwarded to the PluginClient * @return PluginClientDecorator|PluginClient */ public static function createPluginClient( diff --git a/src/DI/HttplugExtension.php b/src/DI/HttplugExtension.php index 18f257d..ae1189d 100644 --- a/src/DI/HttplugExtension.php +++ b/src/DI/HttplugExtension.php @@ -20,6 +20,7 @@ use InvalidArgumentException; use Nette\DI\CompilerExtension; use Nette\DI\ContainerBuilder; +use Nette\DI\Definitions\Definition; use Nette\DI\Definitions\ServiceDefinition; use Nette\DI\Definitions\Statement; use Nette\DI\Helpers; @@ -29,11 +30,10 @@ */ class HttplugExtension extends CompilerExtension { - /** @var bool */ - private $debugMode = false; + private bool $debugMode = false; - /** @var array */ - private static $defaults = [ + /** @var array */ + private static array $defaults = [ # uses discovery if not specified 'classes' => [ 'client' => null, @@ -54,16 +54,16 @@ class HttplugExtension extends CompilerExtension ] ]; - /** @var array */ - private $classes = [ + /** @var array */ + private array $classes = [ 'client' => HttpClient::class, 'messageFactory' => MessageFactory::class, 'uriFactory' => UriFactory::class, 'streamFactory' => StreamFactory::class, ]; - /** @var array */ - private $factoryClasses = [ + /** @var array */ + private array $factoryClasses = [ 'client' => [HttpClientDiscovery::class, 'find'], 'messageFactory' => [MessageFactoryDiscovery::class, 'find'], 'uriFactory' => [UriFactoryDiscovery::class, 'find'], @@ -116,7 +116,7 @@ public function loadConfiguration(): void /** * @param ContainerBuilder $containerBuilder * @param string $clientName - * @param array[] $clientConfig + * @param array $clientConfig */ private function configureClient(ContainerBuilder $containerBuilder, string $clientName, array $clientConfig): void { @@ -152,18 +152,14 @@ private function configureClient(ContainerBuilder $containerBuilder, string $cli } /** - * @param ContainerBuilder $containerBuilder - * @param string $pluginName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition + * @param array $pluginConfig */ private function configurePlugin( ContainerBuilder $containerBuilder, string $pluginName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $creator = 'FreezyBee\Httplug\DI\Plugin\\' . ucfirst($pluginName); diff --git a/src/DI/IClientProvider.php b/src/DI/IClientProvider.php index a773a7d..57ec68f 100644 --- a/src/DI/IClientProvider.php +++ b/src/DI/IClientProvider.php @@ -16,7 +16,7 @@ interface IClientProvider * plugins: * ... - * @return array + * @return array */ public function getClientConfigs(): array; } diff --git a/src/DI/Plugin/AddHost.php b/src/DI/Plugin/AddHost.php index 23af6b3..7220354 100644 --- a/src/DI/Plugin/AddHost.php +++ b/src/DI/Plugin/AddHost.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\AddHostPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; use Psr\Http\Message\UriInterface; @@ -17,19 +17,12 @@ class AddHost implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $uriServiceDef = $containerBuilder ->addDefinition("$extensionName.client.$clientName.plugin.addHost.uri") diff --git a/src/DI/Plugin/Authentication.php b/src/DI/Plugin/Authentication.php index 154997f..a80e7d7 100644 --- a/src/DI/Plugin/Authentication.php +++ b/src/DI/Plugin/Authentication.php @@ -10,7 +10,7 @@ use Http\Message\Authentication\Wsse; use InvalidArgumentException; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -20,20 +20,12 @@ class Authentication implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - * @throws InvalidArgumentException - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $type = $pluginConfig['type'] ?? null; if ($type === null) { diff --git a/src/DI/Plugin/Cache.php b/src/DI/Plugin/Cache.php index 1a4e129..1ddd5a8 100644 --- a/src/DI/Plugin/Cache.php +++ b/src/DI/Plugin/Cache.php @@ -6,8 +6,9 @@ use Http\Client\Common\Plugin\CachePlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; +use Nette\Utils\Strings; /** * @author Jakub Janata @@ -16,19 +17,12 @@ class Cache implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array[] $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $args = []; @@ -44,7 +38,8 @@ public static function createPluginServiceDefinition( $config = []; foreach ($pluginConfig['config'] as $key => $value) { - $config[strtolower(preg_replace('#(.)(?=[A-Z])#', '$1_', $key) ?: '')] = $value; + $newKey = Strings::replace($key, '#(.)(?=[A-Z])#', '$1_'); + $config[strtolower($newKey)] = $value; } $args['config'] = $config; diff --git a/src/DI/Plugin/Cookie.php b/src/DI/Plugin/Cookie.php index f23f3c4..7394692 100644 --- a/src/DI/Plugin/Cookie.php +++ b/src/DI/Plugin/Cookie.php @@ -7,7 +7,7 @@ use Http\Client\Common\Plugin\CookiePlugin; use Http\Message\CookieJar; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -17,19 +17,12 @@ class Cookie implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $cookieJar = $pluginConfig['cookieJar'] ?? new CookieJar(); diff --git a/src/DI/Plugin/Decoder.php b/src/DI/Plugin/Decoder.php index a4007ac..c8c0d08 100644 --- a/src/DI/Plugin/Decoder.php +++ b/src/DI/Plugin/Decoder.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\DecoderPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class Decoder implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder->addDefinition("$extensionName.client.$clientName.plugin.decoder") ->setType(DecoderPlugin::class) diff --git a/src/DI/Plugin/HeaderAppend.php b/src/DI/Plugin/HeaderAppend.php index abe2a94..e4fb84a 100644 --- a/src/DI/Plugin/HeaderAppend.php +++ b/src/DI/Plugin/HeaderAppend.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\HeaderAppendPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class HeaderAppend implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder ->addDefinition("$extensionName.client.$clientName.plugin.headerAppend") diff --git a/src/DI/Plugin/HeaderDefaults.php b/src/DI/Plugin/HeaderDefaults.php index f76a000..1cfc09c 100644 --- a/src/DI/Plugin/HeaderDefaults.php +++ b/src/DI/Plugin/HeaderDefaults.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\HeaderDefaultsPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class HeaderDefaults implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder ->addDefinition("$extensionName.client.$clientName.plugin.headerDefaults") diff --git a/src/DI/Plugin/HeaderRemove.php b/src/DI/Plugin/HeaderRemove.php index 1bf3fc6..8d23eb4 100644 --- a/src/DI/Plugin/HeaderRemove.php +++ b/src/DI/Plugin/HeaderRemove.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\HeaderRemovePlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class HeaderRemove implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder ->addDefinition("$extensionName.client.$clientName.plugin.headerRemove") diff --git a/src/DI/Plugin/HeaderSet.php b/src/DI/Plugin/HeaderSet.php index e0e30b5..159cd51 100644 --- a/src/DI/Plugin/HeaderSet.php +++ b/src/DI/Plugin/HeaderSet.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\HeaderSetPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class HeaderSet implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder ->addDefinition("$extensionName.client.$clientName.plugin.headerSet") diff --git a/src/DI/Plugin/IPluginServiceDefinitonCreator.php b/src/DI/Plugin/IPluginServiceDefinitonCreator.php index 7e60b78..8ecf48d 100644 --- a/src/DI/Plugin/IPluginServiceDefinitonCreator.php +++ b/src/DI/Plugin/IPluginServiceDefinitonCreator.php @@ -5,7 +5,7 @@ namespace FreezyBee\Httplug\DI\Plugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; /** * @author Jakub Janata @@ -13,16 +13,12 @@ interface IPluginServiceDefinitonCreator { /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition + * @param array $pluginConfig */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition; + ): Definition; } diff --git a/src/DI/Plugin/Logger.php b/src/DI/Plugin/Logger.php index 83a3ddc..f5e1f09 100644 --- a/src/DI/Plugin/Logger.php +++ b/src/DI/Plugin/Logger.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\LoggerPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class Logger implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $args = ['formatter' => $pluginConfig['formatter'] ?? null]; diff --git a/src/DI/Plugin/Redirect.php b/src/DI/Plugin/Redirect.php index dddff17..8eac02d 100644 --- a/src/DI/Plugin/Redirect.php +++ b/src/DI/Plugin/Redirect.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\RedirectPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class Redirect implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { $config = []; foreach ($pluginConfig as $key => $value) { diff --git a/src/DI/Plugin/Retry.php b/src/DI/Plugin/Retry.php index e0946c2..bb15c7f 100644 --- a/src/DI/Plugin/Retry.php +++ b/src/DI/Plugin/Retry.php @@ -6,7 +6,7 @@ use Http\Client\Common\Plugin\RetryPlugin; use Nette\DI\ContainerBuilder; -use Nette\DI\ServiceDefinition; +use Nette\DI\Definitions\Definition; use Nette\StaticClass; /** @@ -16,19 +16,12 @@ class Retry implements IPluginServiceDefinitonCreator { use StaticClass; - /** - * @param ContainerBuilder $containerBuilder - * @param string $extensionName - * @param string $clientName - * @param array $pluginConfig - * @return ServiceDefinition - */ public static function createPluginServiceDefinition( ContainerBuilder $containerBuilder, string $extensionName, string $clientName, array $pluginConfig - ): ServiceDefinition { + ): Definition { return $containerBuilder->addDefinition("$extensionName.client.$clientName.plugin.retry") ->setType(RetryPlugin::class) diff --git a/src/Tracy/MessageCollector.php b/src/Tracy/MessageCollector.php index 5980ffb..0702b40 100644 --- a/src/Tracy/MessageCollector.php +++ b/src/Tracy/MessageCollector.php @@ -15,11 +15,9 @@ class MessageCollector { use StaticClass; - /** @var array */ - public static $messages = []; - - /** @var float */ - public static $totalTime; + /** @var array */ + public static array $messages = []; + public static float $totalTime = 0.0; /** * @param RequestInterface $request diff --git a/src/Tracy/PluginClientDecorator.php b/src/Tracy/PluginClientDecorator.php index 998041f..892606c 100644 --- a/src/Tracy/PluginClientDecorator.php +++ b/src/Tracy/PluginClientDecorator.php @@ -19,17 +19,14 @@ class PluginClientDecorator implements HttpClient, HttpAsyncClient { use SmartObject; - /** @var PluginClient */ - private $pluginClient; - - /** @var TracyPlugin */ - private $tracyPlugin; + private PluginClient $pluginClient; + private TracyPlugin $tracyPlugin; /** * PluginClientDecorator constructor. * @param HttpClient|HttpAsyncClient $client - * @param array $plugins - * @param array $options + * @param array $plugins + * @param array $options */ public function __construct($client, array $plugins = [], array $options = []) { diff --git a/tests/Utils/RouterFactory.php b/tests/Utils/RouterFactory.php index c4fb7f9..9db4bd1 100644 --- a/tests/Utils/RouterFactory.php +++ b/tests/Utils/RouterFactory.php @@ -4,8 +4,8 @@ namespace FreezyBee\Httplug\Tests\Utils; -use Nette\Application\IRouter; use Nette\Application\Routers\Route; +use Nette\Routing\Router; use Nette\StaticClass; /** @@ -15,10 +15,7 @@ class RouterFactory { use StaticClass; - /** - * @return IRouter - */ - public static function createRouter(): IRouter + public static function createRouter(): Router { return new Route('', 'Test:'); } diff --git a/tests/Utils/TestPlugin.php b/tests/Utils/TestPlugin.php index c274b58..76a6753 100644 --- a/tests/Utils/TestPlugin.php +++ b/tests/Utils/TestPlugin.php @@ -13,18 +13,14 @@ */ class TestPlugin implements Plugin { - /** @var array */ - private $config; - - /** @var mixed */ - private $service; + /** @var array */ + public array $config; + public object $service; /** - * TestPlugin constructor. - * @param array $config - * @param mixed $service + * @param array $config */ - public function __construct(array $config, $service) + public function __construct(array $config, object $service) { $this->config = $config; $this->service = $service;