Fix deprecations (#1924)

This commit is contained in:
Guilhem Niot 2021-12-11 14:22:14 +01:00 committed by GitHub
parent c0b57fd371
commit f5fb7a4088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 9 deletions

View File

@ -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');

View File

@ -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 = [
// ...

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();
}