Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@ jobs:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
symfony:
- '6.4.*'
- '7.1.*'
- '7.4.*'
elasticsearch:
- '8.12.0'
dependencies:
- 'highest'
exclude:
- php: '8.1'
symfony: '7.1.*'
symfony: '7.4.*'
fail-fast: false
steps:
- name: 'Checkout'
Expand Down Expand Up @@ -99,9 +100,10 @@ jobs:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
symfony:
- '6.4.*'
- '7.1.*'
- '7.4.*'
dependencies:
- 'highest'
include:
Expand All @@ -110,7 +112,7 @@ jobs:
symfony: '6.4.*'
exclude:
- php: '8.1'
symfony: '7.1.*'
symfony: '7.4.*'

fail-fast: false
steps:
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'native_constant_invocation' => true,
'native_function_invocation' => [
'include' => ['@all'],
'exclude' => ['service', 'abstract_arg', 'param', 'tagged_locator', 'tagged_iterator', 'inline_service', 'env'],
],
'no_alias_functions' => true,
'nullable_type_declaration_for_default_null_value' => true,
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"pagerfanta/pagerfanta": "^3.0 || ^4.0",
"psr/log": "^3.0",
"ruflin/elastica": "^8.0",
"symfony/console": "^6.4 || ^7.1",
"symfony/dependency-injection": "^6.4 || ^7.1",
"symfony/event-dispatcher": "^6.4 || ^7.1",
"symfony/framework-bundle": "^6.4 || ^7.1",
"symfony/property-access": "^6.4 || ^7.1",
"symfony/stopwatch": "^6.4 || ^7.1"
"symfony/console": "^6.4 || ^7.4 || ^8.0",
"symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0",
"symfony/event-dispatcher": "^6.4 || ^7.4 || ^8.0",
"symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0",
"symfony/property-access": "^6.4 || ^7.4 || ^8.0",
"symfony/stopwatch": "^6.4 || ^7.4 || ^8.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.1.1",
Expand All @@ -57,12 +57,12 @@
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpunit/phpunit": "^9.5",
"symfony/expression-language": "^6.4 || ^7.1",
"symfony/messenger": "^6.4 || ^7.1",
"symfony/serializer": "^6.4 || ^7.1",
"symfony/twig-bundle": "^6.4 || ^7.1",
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
"symfony/yaml": "^6.4 || ^7.1"
"symfony/expression-language": "^6.4 || ^7.4 || ^8.0",
"symfony/messenger": "^6.4 || ^7.4 || ^8.0",
"symfony/serializer": "^6.4 || ^7.4 || ^8.0",
"symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0",
"symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8.0",
"symfony/yaml": "^6.4 || ^7.4 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<1.12.0"
Expand Down
3 changes: 3 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ parameters:
path: src/Finder/PaginatedHybridFinderInterface.php
- message: '/PHPDoc tag @return contains generic type Pagerfanta\\PagerfantaInterface<Elastica\\Result> but interface Pagerfanta\\PagerfantaInterface is not generic/'
path: src/Finder/PaginatedRawFinderInterface.php
# Symfony 7.4+ added generic type annotations to Config component classes
- message: '/Call to method \w+\(\) on an unknown class Symfony\\Component\\Config\\Definition\\Builder\\\w+<.*>/'
path: src/DependencyInjection/Configuration.php
5 changes: 1 addition & 4 deletions src/Command/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public function __construct(
$this->aliasProcessor = $aliasProcessor;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:create')
Expand Down
5 changes: 1 addition & 4 deletions src/Command/DeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ public function __construct(
$this->indexManager = $indexManager;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:delete')
Expand Down
10 changes: 2 additions & 8 deletions src/Command/PopulateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ public function __construct(
$this->resetter = $resetter;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:populate')
Expand All @@ -85,10 +82,7 @@ protected function configure()
;
}

/**
* @return void
*/
protected function initialize(InputInterface $input, OutputInterface $output)
protected function initialize(InputInterface $input, OutputInterface $output): void
{
$this->pagerPersister = $this->pagerPersisterRegistry->getPagerPersister($input->getOption('pager-persister'));

Expand Down
5 changes: 1 addition & 4 deletions src/Command/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public function __construct(
$this->resetter = $resetter;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:reset')
Expand Down
5 changes: 1 addition & 4 deletions src/Command/ResetTemplatesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function __construct(
$this->resetter = $resetter;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:reset-templates')
Expand Down
5 changes: 1 addition & 4 deletions src/Command/SearchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function __construct(IndexManager $indexManager)
$this->indexManager = $indexManager;
}

/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->setName('fos:elastica:search')
Expand Down
5 changes: 1 addition & 4 deletions src/DataCollector/ElasticaDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ public function __construct(ElasticaLogger $logger)
$this->logger = $logger;
}

/**
* @return void
*/
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$this->data['nb_queries'] = $this->logger->getNbQueries();
$this->data['queries'] = $this->logger->getQueries();
Expand Down
5 changes: 1 addition & 4 deletions src/DependencyInjection/Compiler/ConfigSourcePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ class ConfigSourcePass implements CompilerPassInterface
{
public const SOURCE_TYPE_INDEX_TEMPLATE = 'index_template';

/**
* @return void
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('fos_elastica.config_manager')) {
return;
Expand Down
5 changes: 1 addition & 4 deletions src/DependencyInjection/Compiler/IndexPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

class IndexPass implements CompilerPassInterface
{
/**
* @return void
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('fos_elastica.index_manager')) {
return;
Expand Down
20 changes: 9 additions & 11 deletions src/DependencyInjection/FOSElasticaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Messenger\MessageBusInterface;

Expand Down Expand Up @@ -72,15 +72,15 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

if (empty($config['clients']) || empty($config['indexes'])) {
// No Clients or indexes are defined
return;
}

foreach (['config', 'index', 'persister', 'provider', 'source', 'transformer', 'event_listener', 'commands'] as $basename) {
$loader->load(\sprintf('%s.xml', $basename));
$loader->load(\sprintf('%s.php', $basename));
}

if (empty($config['default_client'])) {
Expand All @@ -98,7 +98,7 @@ public function load(array $configs, ContainerBuilder $container): void
}

if (isset($config['serializer'])) {
$loader->load('serializer.xml');
$loader->load('serializer.php');

$this->loadSerializer($config['serializer'], $container);
}
Expand Down Expand Up @@ -139,10 +139,8 @@ public function load(array $configs, ContainerBuilder $container): void

/**
* @param array<mixed> $config
*
* @return Configuration
*/
public function getConfiguration(array $config, ContainerBuilder $container)
public function getConfiguration(array $config, ContainerBuilder $container): Configuration
{
return new Configuration($container->getParameter('kernel.debug'));
}
Expand Down Expand Up @@ -759,8 +757,8 @@ private function loadDriver(ContainerBuilder $container, string $driver): void
return;
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load($driver.'.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load($driver.'.php');
$this->loadedDrivers[] = $driver;
}

Expand Down Expand Up @@ -820,13 +818,13 @@ private function getClient(string $clientName): Reference
return $this->clients[$clientName]['reference'];
}

private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader): void
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void
{
if (!\interface_exists(MessageBusInterface::class)) {
throw new LogicException('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger".');
}

$loader->load('messenger.xml');
$loader->load('messenger.php');

$container->setAlias('fos_elastica.messenger.bus', $config['bus']);
}
Expand Down
5 changes: 1 addition & 4 deletions src/FOSElasticaBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

class FOSElasticaBundle extends Bundle
{
/**
* @return void
*/
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);

Expand Down
73 changes: 73 additions & 0 deletions src/Resources/config/commands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

/*
* This file is part of the FOSElasticaBundle package.
*
* (c) FriendsOfSymfony <https://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use FOS\ElasticaBundle\Command\CreateCommand;
use FOS\ElasticaBundle\Command\DeleteCommand;
use FOS\ElasticaBundle\Command\PopulateCommand;
use FOS\ElasticaBundle\Command\ResetCommand;
use FOS\ElasticaBundle\Command\ResetTemplatesCommand;
use FOS\ElasticaBundle\Command\SearchCommand;

return static function (ContainerConfigurator $container): void {
$services = $container->services();

$services->set('fos_elastica.command.create', CreateCommand::class)
->tag('console.command', ['command' => 'fos:elastica:create'])
->args([
service('fos_elastica.index_manager'),
service('fos_elastica.mapping_builder'),
service('fos_elastica.config_manager'),
service('fos_elastica.alias_processor'),
])
;

$services->set('fos_elastica.command.delete', DeleteCommand::class)
->tag('console.command', ['command' => 'fos:elastica:delete'])
->args([
service('fos_elastica.index_manager'),
])
;

$services->set('fos_elastica.command.populate', PopulateCommand::class)
->tag('console.command', ['command' => 'fos:elastica:populate'])
->args([
service('event_dispatcher'),
service('fos_elastica.index_manager'),
service('fos_elastica.pager_provider_registry'),
service('fos_elastica.pager_persister_registry'),
service('fos_elastica.resetter'),
])
;

$services->set('fos_elastica.command.reset', ResetCommand::class)
->tag('console.command', ['command' => 'fos:elastica:reset'])
->args([
service('fos_elastica.index_manager'),
service('fos_elastica.resetter'),
])
;

$services->set('fos_elastica.command.templates_reset', ResetTemplatesCommand::class)
->tag('console.command', ['command' => 'fos:elastica:reset-templates'])
->args([
service('fos_elastica.template_resetter'),
])
;

$services->set('fos_elastica.command.search', SearchCommand::class)
->tag('console.command', ['command' => 'fos:elastica:search'])
->args([
service('fos_elastica.index_manager'),
])
;
};
Loading
Loading