From f5fb7a408824d44d36453f6edff20f9fa05296a1 Mon Sep 17 00:00:00 2001 From: Guilhem Niot Date: Sat, 11 Dec 2021 14:22:14 +0100 Subject: [PATCH] Fix deprecations (#1924) --- DependencyInjection/Configuration.php | 2 +- Resources/doc/index.rst | 2 +- Tests/Functional/ArrayItemsErrorTest.php | 3 ++- Tests/Functional/BazingaFunctionalTest.php | 3 ++- Tests/Functional/JMSFunctionalTest.php | 4 +++- Tests/Functional/TestKernel.php | 6 +++--- Tests/Functional/WebTestCase.php | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 7fcbb65..f24561a 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface; final class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('nelmio_api_doc'); diff --git a/Resources/doc/index.rst b/Resources/doc/index.rst index 97277f7..d4200b6 100644 --- a/Resources/doc/index.rst +++ b/Resources/doc/index.rst @@ -39,7 +39,7 @@ Open a command console, enter your project directory and execute the following c class AppKernel extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { $bundles = [ // ... diff --git a/Tests/Functional/ArrayItemsErrorTest.php b/Tests/Functional/ArrayItemsErrorTest.php index cd8214e..2f840e7 100644 --- a/Tests/Functional/ArrayItemsErrorTest.php +++ b/Tests/Functional/ArrayItemsErrorTest.php @@ -12,6 +12,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; use Nelmio\ApiDocBundle\Exception\UndocumentedArrayItemsException; +use Symfony\Component\HttpKernel\KernelInterface; class ArrayItemsErrorTest extends WebTestCase { @@ -30,7 +31,7 @@ class ArrayItemsErrorTest extends WebTestCase $this->getSwaggerDefinition(); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return new TestKernel(TestKernel::ERROR_ARRAY_ITEMS); } diff --git a/Tests/Functional/BazingaFunctionalTest.php b/Tests/Functional/BazingaFunctionalTest.php index 6be482b..cf4a786 100644 --- a/Tests/Functional/BazingaFunctionalTest.php +++ b/Tests/Functional/BazingaFunctionalTest.php @@ -12,6 +12,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; use Hateoas\Configuration\Embedded; +use Symfony\Component\HttpKernel\KernelInterface; class BazingaFunctionalTest extends WebTestCase { @@ -120,7 +121,7 @@ class BazingaFunctionalTest extends WebTestCase ], $this->getModel('BazingaUserTyped')->toArray()); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return new TestKernel(TestKernel::USE_JMS | TestKernel::USE_BAZINGA); } diff --git a/Tests/Functional/JMSFunctionalTest.php b/Tests/Functional/JMSFunctionalTest.php index 5645f0f..363323e 100644 --- a/Tests/Functional/JMSFunctionalTest.php +++ b/Tests/Functional/JMSFunctionalTest.php @@ -11,6 +11,8 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; +use Symfony\Component\HttpKernel\KernelInterface; + class JMSFunctionalTest extends WebTestCase { protected function setUp(): void @@ -302,7 +304,7 @@ class JMSFunctionalTest extends WebTestCase ], $this->getModel('JMSNamingStrategyConstraints')->toArray()); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return new TestKernel(TestKernel::USE_JMS); } diff --git a/Tests/Functional/TestKernel.php b/Tests/Functional/TestKernel.php index b56220d..dc1a47e 100644 --- a/Tests/Functional/TestKernel.php +++ b/Tests/Functional/TestKernel.php @@ -52,7 +52,7 @@ class TestKernel extends Kernel /** * {@inheritdoc} */ - public function registerBundles() + public function registerBundles(): iterable { $bundles = [ new FrameworkBundle(), @@ -241,7 +241,7 @@ class TestKernel extends Kernel /** * {@inheritdoc} */ - public function getCacheDir() + public function getCacheDir(): string { return parent::getCacheDir().'/'.$this->flags; } @@ -249,7 +249,7 @@ class TestKernel extends Kernel /** * {@inheritdoc} */ - public function getLogDir() + public function getLogDir(): string { return parent::getLogDir().'/'.$this->flags; } diff --git a/Tests/Functional/WebTestCase.php b/Tests/Functional/WebTestCase.php index 24d371e..4fc2d72 100644 --- a/Tests/Functional/WebTestCase.php +++ b/Tests/Functional/WebTestCase.php @@ -14,10 +14,11 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; use EXSyst\Component\Swagger\Operation; use EXSyst\Component\Swagger\Schema; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; +use Symfony\Component\HttpKernel\KernelInterface; class WebTestCase extends BaseWebTestCase { - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return new TestKernel(); }