Fix deprecations (#1923)

This commit is contained in:
Guilhem Niot 2021-12-11 14:19:43 +01:00 committed by GitHub
parent 4148dfda25
commit a184cb8ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 10 deletions

View File

@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface final class Configuration implements ConfigurationInterface
{ {
public function getConfigTreeBuilder() public function getConfigTreeBuilder(): TreeBuilder
{ {
$treeBuilder = new TreeBuilder('nelmio_api_doc'); $treeBuilder = new TreeBuilder('nelmio_api_doc');

View File

@ -28,8 +28,8 @@ class ObjectPropertyDescriber implements PropertyDescriberInterface, ModelRegist
false, false,
$types[0]->getClassName(), $types[0]->getClassName(),
$types[0]->isCollection(), $types[0]->isCollection(),
$types[0]->getCollectionKeyType(),
// BC layer for symfony < 5.3 // BC layer for symfony < 5.3
method_exists($types[0], 'getCollectionKeyTypes') ? $types[0]->getCollectionKeyTypes() : $types[0]->getCollectionKeyType(),
method_exists($types[0], 'getCollectionValueTypes') ? method_exists($types[0], 'getCollectionValueTypes') ?
($types[0]->getCollectionValueTypes()[0] ?? null) : ($types[0]->getCollectionValueTypes()[0] ?? null) :
$types[0]->getCollectionValueType() $types[0]->getCollectionValueType()

View File

@ -39,7 +39,7 @@ Open a command console, enter your project directory and execute the following c
class AppKernel extends Kernel class AppKernel extends Kernel
{ {
public function registerBundles() public function registerBundles(): iterable
{ {
$bundles = [ $bundles = [
// ... // ...

View File

@ -12,6 +12,7 @@
namespace Nelmio\ApiDocBundle\Tests\Functional; namespace Nelmio\ApiDocBundle\Tests\Functional;
use Nelmio\ApiDocBundle\Exception\UndocumentedArrayItemsException; use Nelmio\ApiDocBundle\Exception\UndocumentedArrayItemsException;
use Symfony\Component\HttpKernel\KernelInterface;
class ArrayItemsErrorTest extends WebTestCase class ArrayItemsErrorTest extends WebTestCase
{ {
@ -30,7 +31,7 @@ class ArrayItemsErrorTest extends WebTestCase
$this->getOpenApiDefinition(); $this->getOpenApiDefinition();
} }
protected static function createKernel(array $options = []) protected static function createKernel(array $options = []): KernelInterface
{ {
return new TestKernel(TestKernel::ERROR_ARRAY_ITEMS); return new TestKernel(TestKernel::ERROR_ARRAY_ITEMS);
} }

View File

@ -12,6 +12,7 @@
namespace Nelmio\ApiDocBundle\Tests\Functional; namespace Nelmio\ApiDocBundle\Tests\Functional;
use Hateoas\Configuration\Embedded; use Hateoas\Configuration\Embedded;
use Symfony\Component\HttpKernel\KernelInterface;
class BazingaFunctionalTest extends WebTestCase class BazingaFunctionalTest extends WebTestCase
{ {
@ -123,7 +124,7 @@ class BazingaFunctionalTest extends WebTestCase
], json_decode($this->getModel('BazingaUserTyped')->toJson(), true)); ], json_decode($this->getModel('BazingaUserTyped')->toJson(), true));
} }
protected static function createKernel(array $options = []) protected static function createKernel(array $options = []): KernelInterface
{ {
return new TestKernel(TestKernel::USE_JMS | TestKernel::USE_BAZINGA); return new TestKernel(TestKernel::USE_JMS | TestKernel::USE_BAZINGA);
} }

View File

@ -11,6 +11,8 @@
namespace Nelmio\ApiDocBundle\Tests\Functional; namespace Nelmio\ApiDocBundle\Tests\Functional;
use Symfony\Component\HttpKernel\KernelInterface;
class JMSFunctionalTest extends WebTestCase class JMSFunctionalTest extends WebTestCase
{ {
protected function setUp(): void protected function setUp(): void
@ -333,7 +335,7 @@ class JMSFunctionalTest extends WebTestCase
], json_decode($this->getModel('JMSNamingStrategyConstraints')->toJson(), true)); ], json_decode($this->getModel('JMSNamingStrategyConstraints')->toJson(), true));
} }
protected static function createKernel(array $options = []) protected static function createKernel(array $options = []): KernelInterface
{ {
return new TestKernel(TestKernel::USE_JMS); return new TestKernel(TestKernel::USE_JMS);
} }

View File

@ -53,7 +53,7 @@ class TestKernel extends Kernel
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function registerBundles() public function registerBundles(): iterable
{ {
$bundles = [ $bundles = [
new FrameworkBundle(), new FrameworkBundle(),
@ -275,7 +275,7 @@ class TestKernel extends Kernel
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getCacheDir() public function getCacheDir(): string
{ {
return parent::getCacheDir().'/'.$this->flags; return parent::getCacheDir().'/'.$this->flags;
} }
@ -283,7 +283,7 @@ class TestKernel extends Kernel
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getLogDir() public function getLogDir(): string
{ {
return parent::getLogDir().'/'.$this->flags; return parent::getLogDir().'/'.$this->flags;
} }

View File

@ -13,10 +13,11 @@ namespace Nelmio\ApiDocBundle\Tests\Functional;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\HttpKernel\KernelInterface;
class WebTestCase extends BaseWebTestCase class WebTestCase extends BaseWebTestCase
{ {
protected static function createKernel(array $options = []) protected static function createKernel(array $options = []): KernelInterface
{ {
return new TestKernel(); return new TestKernel();
} }