From afc63a4a4e7171a01cb71c768580841fcdc03ccf Mon Sep 17 00:00:00 2001 From: pmishev Date: Mon, 11 Nov 2024 12:33:55 +0000 Subject: [PATCH] Clearing deprecation notices --- src/CacheWarmer/MetadataCacheWarmer.php | 4 ++-- src/Command/IndexBuildCommand.php | 5 ++--- src/Command/IndexCreateCommand.php | 5 ++--- src/Mapping/DocumentMetadataCollector.php | 2 +- src/SineflowElasticsearchBundle.php | 2 +- tests/AbstractContainerAwareTestCase.php | 5 +---- tests/AbstractElasticsearchTestCase.php | 4 +--- .../Provider/ElasticsearchProviderTest.php | 2 +- .../Provider/ProviderRegistryTest.php | 7 ++---- tests/Functional/Document/RepositoryTest.php | 22 +++++-------------- .../Adapter/KnpPaginatorAdapterTest.php | 2 +- .../Finder/Adapter/ScrollAdapterTest.php | 2 +- tests/Functional/Finder/FinderTest.php | 2 +- tests/Functional/Manager/IndexManagerTest.php | 2 +- .../Profiler/ElasticsearchProfilerTest.php | 2 +- .../Result/DocumentIteratorTest.php | 2 +- tests/Unit/Annotation/DocumentTest.php | 2 +- tests/Unit/Annotation/PropertyTest.php | 2 +- 18 files changed, 26 insertions(+), 48 deletions(-) diff --git a/src/CacheWarmer/MetadataCacheWarmer.php b/src/CacheWarmer/MetadataCacheWarmer.php index 5a57076..8eecab6 100644 --- a/src/CacheWarmer/MetadataCacheWarmer.php +++ b/src/CacheWarmer/MetadataCacheWarmer.php @@ -16,8 +16,8 @@ public function isOptional(): bool return true; } - public function warmUp(string $cacheDir): array + public function warmUp(string $cacheDir, ?string $buildDir = null): array { - return $this->metadataCollector->warmUp($cacheDir); + return $this->metadataCollector->warmUp($cacheDir, $buildDir); } } diff --git a/src/Command/IndexBuildCommand.php b/src/Command/IndexBuildCommand.php index dac01c4..9997426 100644 --- a/src/Command/IndexBuildCommand.php +++ b/src/Command/IndexBuildCommand.php @@ -3,6 +3,7 @@ namespace Sineflow\ElasticsearchBundle\Command; use Sineflow\ElasticsearchBundle\Manager\IndexManagerRegistry; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -12,10 +13,9 @@ /** * Command for (re)building elasticsearch index. */ +#[AsCommand('sineflow:es:index:build', '(Re)builds elasticsearch index.')] class IndexBuildCommand extends Command { - protected static $defaultName = 'sineflow:es:index:build'; - public function __construct(private readonly IndexManagerRegistry $indexManagerRegistry) { parent::__construct(); @@ -29,7 +29,6 @@ protected function configure(): void parent::configure(); $this - ->setDescription('(Re)builds elasticsearch index.') ->addArgument( 'index', InputArgument::REQUIRED, diff --git a/src/Command/IndexCreateCommand.php b/src/Command/IndexCreateCommand.php index aadec7e..05b2dba 100644 --- a/src/Command/IndexCreateCommand.php +++ b/src/Command/IndexCreateCommand.php @@ -3,6 +3,7 @@ namespace Sineflow\ElasticsearchBundle\Command; use Sineflow\ElasticsearchBundle\Manager\IndexManagerRegistry; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -11,10 +12,9 @@ /** * Command for creating elasticsearch index. */ +#[AsCommand('sineflow:es:index:create', 'Creates elasticsearch index.')] class IndexCreateCommand extends Command { - protected static $defaultName = 'sineflow:es:index:create'; - public function __construct(private readonly IndexManagerRegistry $indexManagerRegistry) { parent::__construct(); @@ -28,7 +28,6 @@ protected function configure(): void parent::configure(); $this - ->setDescription('Creates elasticsearch index.') ->addArgument( 'index', InputArgument::REQUIRED, diff --git a/src/Mapping/DocumentMetadataCollector.php b/src/Mapping/DocumentMetadataCollector.php index a82587c..7d046c2 100644 --- a/src/Mapping/DocumentMetadataCollector.php +++ b/src/Mapping/DocumentMetadataCollector.php @@ -57,7 +57,7 @@ public function __construct( * * @throws InvalidArgumentException */ - public function warmUp(string $cacheDir): array + public function warmUp(string $cacheDir, ?string $buildDir = null): array { // force cache generation foreach ($this->documentClassToIndexManagerNames as $documentClass => $indexManagerName) { diff --git a/src/SineflowElasticsearchBundle.php b/src/SineflowElasticsearchBundle.php index bf027ca..9e64ba1 100644 --- a/src/SineflowElasticsearchBundle.php +++ b/src/SineflowElasticsearchBundle.php @@ -16,7 +16,7 @@ class SineflowElasticsearchBundle extends Bundle /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { parent::build($container); diff --git a/tests/AbstractContainerAwareTestCase.php b/tests/AbstractContainerAwareTestCase.php index 51a5ea6..d79bd98 100644 --- a/tests/AbstractContainerAwareTestCase.php +++ b/tests/AbstractContainerAwareTestCase.php @@ -22,10 +22,7 @@ abstract class AbstractContainerAwareTestCase extends KernelTestCase */ abstract class AbstractContainerAwareTestCase extends KernelTestCase { - /** - * @var ContainerInterface - */ - private $cachedContainer; + private ?ContainerInterface $cachedContainer; /** * {@inheritDoc} diff --git a/tests/AbstractElasticsearchTestCase.php b/tests/AbstractElasticsearchTestCase.php index a9f3702..18a2f45 100644 --- a/tests/AbstractElasticsearchTestCase.php +++ b/tests/AbstractElasticsearchTestCase.php @@ -32,10 +32,8 @@ abstract class AbstractElasticsearchTestCase extends AbstractContainerAwareTestC * ] * ] * ] - * - * @return array */ - protected function getDataArray() + protected function getDataArray(): array { return []; } diff --git a/tests/Functional/Document/Provider/ElasticsearchProviderTest.php b/tests/Functional/Document/Provider/ElasticsearchProviderTest.php index 44829f1..703c5d9 100644 --- a/tests/Functional/Document/Provider/ElasticsearchProviderTest.php +++ b/tests/Functional/Document/Provider/ElasticsearchProviderTest.php @@ -11,7 +11,7 @@ class ElasticsearchProviderTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Document/Provider/ProviderRegistryTest.php b/tests/Functional/Document/Provider/ProviderRegistryTest.php index eb32924..ab56f2f 100644 --- a/tests/Functional/Document/Provider/ProviderRegistryTest.php +++ b/tests/Functional/Document/Provider/ProviderRegistryTest.php @@ -14,15 +14,12 @@ class ProviderRegistryTest extends AbstractElasticsearchTestCase { - /** - * @var ProviderRegistry - */ - private $providerRegistry; + private ProviderRegistry $providerRegistry; /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Document/RepositoryTest.php b/tests/Functional/Document/RepositoryTest.php index b21c619..3259cce 100644 --- a/tests/Functional/Document/RepositoryTest.php +++ b/tests/Functional/Document/RepositoryTest.php @@ -13,30 +13,18 @@ class RepositoryTest extends AbstractElasticsearchTestCase { use AssertThrows; - /** - * @var Repository - */ - private $repository; + private Repository $repository; - /** - * @var IndexManager - */ - private $indexManager; + private IndexManager $indexManager; - /** - * @var Finder - */ - private $finder; + private Finder $finder; - /** - * @var DocumentMetadataCollector - */ - private $metadataCollector; + private DocumentMetadataCollector $metadataCollector; /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Finder/Adapter/KnpPaginatorAdapterTest.php b/tests/Functional/Finder/Adapter/KnpPaginatorAdapterTest.php index 74f67b5..1898b82 100644 --- a/tests/Functional/Finder/Adapter/KnpPaginatorAdapterTest.php +++ b/tests/Functional/Finder/Adapter/KnpPaginatorAdapterTest.php @@ -15,7 +15,7 @@ class KnpPaginatorAdapterTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Finder/Adapter/ScrollAdapterTest.php b/tests/Functional/Finder/Adapter/ScrollAdapterTest.php index 4e98f1c..7ff01ea 100644 --- a/tests/Functional/Finder/Adapter/ScrollAdapterTest.php +++ b/tests/Functional/Finder/Adapter/ScrollAdapterTest.php @@ -13,7 +13,7 @@ class ScrollAdapterTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Finder/FinderTest.php b/tests/Functional/Finder/FinderTest.php index 4436631..8b5b75d 100644 --- a/tests/Functional/Finder/FinderTest.php +++ b/tests/Functional/Finder/FinderTest.php @@ -21,7 +21,7 @@ class FinderTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Manager/IndexManagerTest.php b/tests/Functional/Manager/IndexManagerTest.php index 81ed2ec..f5061fa 100644 --- a/tests/Functional/Manager/IndexManagerTest.php +++ b/tests/Functional/Manager/IndexManagerTest.php @@ -25,7 +25,7 @@ class IndexManagerTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Functional/Profiler/ElasticsearchProfilerTest.php b/tests/Functional/Profiler/ElasticsearchProfilerTest.php index a415e62..0b752a1 100644 --- a/tests/Functional/Profiler/ElasticsearchProfilerTest.php +++ b/tests/Functional/Profiler/ElasticsearchProfilerTest.php @@ -16,7 +16,7 @@ class ElasticsearchProfilerTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'default' => [ diff --git a/tests/Functional/Result/DocumentIteratorTest.php b/tests/Functional/Result/DocumentIteratorTest.php index 074fe1c..4cf6783 100644 --- a/tests/Functional/Result/DocumentIteratorTest.php +++ b/tests/Functional/Result/DocumentIteratorTest.php @@ -18,7 +18,7 @@ class DocumentIteratorTest extends AbstractElasticsearchTestCase /** * {@inheritdoc} */ - protected function getDataArray() + protected function getDataArray(): array { return [ 'bar' => [ diff --git a/tests/Unit/Annotation/DocumentTest.php b/tests/Unit/Annotation/DocumentTest.php index 48152f4..51521d5 100644 --- a/tests/Unit/Annotation/DocumentTest.php +++ b/tests/Unit/Annotation/DocumentTest.php @@ -17,7 +17,7 @@ public function testDump(): void { $doc = new Document(); - $doc->type = 'product'; + $doc->repositoryClass = 'some class name'; $doc->options = [ 'dynamic' => 'strict', 'foo' => 'bar', diff --git a/tests/Unit/Annotation/PropertyTest.php b/tests/Unit/Annotation/PropertyTest.php index 35bed20..ae140a1 100644 --- a/tests/Unit/Annotation/PropertyTest.php +++ b/tests/Unit/Annotation/PropertyTest.php @@ -27,7 +27,7 @@ public function testDump(): void 'analyzer' => 'standard', 'foo' => 'bar', ]; - $type->foo = 'bar'; + $type->enumType = 'bar'; $this->assertEquals( [