Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Symfony 7 #1938

Merged
merged 43 commits into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0967ec7
Update dependencies
l-you Dec 4, 2023
14917c4
add php 8.3
l-you Dec 4, 2023
6ba4850
add symfony 7 to tests
l-you Dec 4, 2023
6e4d891
exclude php 7.4 from tests for symfony 7
l-you Dec 4, 2023
c36fea7
Exclude all php versions prior to 8.2 for Symfony 7. Minimum supporte…
l-you Dec 4, 2023
5d556fe
Require minimum doctrine/phpcr-odm 1.5.3. This is the lowest version …
l-you Dec 4, 2023
22c8a4c
Exclude php 8.3 symfony 7 lowest dependencies from CI. Higher doctrin…
l-you Dec 4, 2023
8ebec77
Revert "Exclude php 8.3 symfony 7 lowest dependencies from CI. Higher…
l-you Dec 4, 2023
724e5ae
Run cs fixer
l-you Dec 4, 2023
916337a
fix code style
l-you Dec 4, 2023
1a637b1
fix a suddenly excluded case
l-you Dec 4, 2023
6b889af
Lock to symfony/console@^6.1 because of issue with doctrine/phpcr-odm…
l-you Dec 4, 2023
5621661
run cs fixer
l-you Dec 4, 2023
7450153
Bump jms/serializer-bundle to v5
l-you Dec 4, 2023
953d5d4
Remove jms/serializer-bundle v3 support because php 7.2 has reached a…
l-you Dec 4, 2023
8f43f71
add php 8.3 to phpstan
l-you Dec 4, 2023
a6e0a93
Update all Symfony references to ^6.3
l-you Dec 4, 2023
d47ae8e
Add symfony/console 7.0 to dependencies.
l-you Dec 4, 2023
35ac8e6
Normalize continuous integration matrix.
l-you Dec 4, 2023
92f62e1
Normalize continuous integration matrix.
l-you Dec 4, 2023
5d393fe
update gitignore
l-you Dec 12, 2023
c8652ab
fix gitignore
l-you Jan 30, 2024
78d403e
fix typo
l-you Jan 30, 2024
c48f5f8
Replace php-cs-fixer with a shim version. It allows us to lock with a…
l-you Feb 29, 2024
f773e12
Run php-cs-fixer with locked version 3.8.0.
l-you Feb 29, 2024
a85750b
Add support for doctrine/phpcr-odm 2-beta release.
l-you Feb 29, 2024
7d4a0d6
Cs fixer fix
l-you Feb 29, 2024
b5d922b
Bump knplabs/knp-components
l-you Feb 29, 2024
e69a186
Fix php cs fixer version.
l-you Feb 29, 2024
1f31f71
CS Fixer fixes with version 3.8.0.
l-you Feb 29, 2024
25c8b10
Add symfony/stopwatch because it's required by project
l-you Feb 29, 2024
bb351e8
Bumb jackalope/jackalope-doctrine-dbal to RC-1
l-you Feb 29, 2024
4320d34
Normalize composer
l-you Feb 29, 2024
015463c
Disable symfony testing with php 8.2 and 8.3
l-you Feb 29, 2024
5d30843
minimum stability RC
l-you Mar 7, 2024
3b7042c
[cs] Fix composer.json
evertharmeling Mar 20, 2024
05df890
[phpunit] Fix 'framework.annotations' error
evertharmeling Mar 20, 2024
8f1d7f8
[phpunit] Fix 'getAliasNamespace' error
evertharmeling Mar 20, 2024
1da0292
[phpunit] Not use CodeExtension anymore
evertharmeling Mar 20, 2024
22df9c2
[phpunit] Variable 'profile_type' does not exist
evertharmeling Mar 20, 2024
69b18df
Make use of 'AsMessageHandler' attribute in favor of MessageHandlerIn…
evertharmeling Mar 20, 2024
00570f0
[phpstan] Excluded AsyncPersistPageHandler as attributes are not supp…
evertharmeling Mar 20, 2024
f1c3104
[phpstan] Fix ContainerAwareInterface not found
evertharmeling Mar 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/workflows/continuous-integration.yaml
Expand Up @@ -40,24 +40,24 @@ jobs:
- '7.4'
- '8.1'
- '8.2'
- '8.3'
symfony:
- '4.4.*'
- '5.4.*'
- '6.2.*'
- '6.3.*'
- '7.0.*'
elasticsearch:
- '7.11.0'
dependencies:
- 'highest'
include:
- php: '7.4'
elasticsearch: '7.0.0'
dependencies: 'lowest'
symfony: '4.4.*'
exclude:
- php: '7.4'
symfony: '6.2.*'
dependencies: 'highest'
elasticsearch: '7.11.0'
symfony: '7.0.*'
- php: '7.4'
symfony: '6.3.*'
- php: '8.0'
symfony: '7.0.*'
- php: '8.1'
symfony: '7.0.*'
fail-fast: false
steps:
- name: 'Checkout'
Expand Down Expand Up @@ -103,20 +103,29 @@ jobs:
- '7.4'
- '8.1'
- '8.2'
- '8.3'
symfony:
- '4.4.*'
- '5.4.*'
- '6.2.*'
- '6.3.*'
- '7.0.*'
dependencies:
- 'highest'
include:
- php: '7.4'
dependencies: 'lowest'
symfony: '4.4.*'
symfony: '5.4.*'
exclude:
- php: '7.4'
symfony: '6.2.*'
dependencies: 'highest'
symfony: '7.0.*'
- php: '7.4'
symfony: '6.3.*'
- php: '8.0'
symfony: '7.0.*'
- php: '8.1'
symfony: '7.0.*'
- php: '8.1'
symfony: '4.4.*'

fail-fast: false
steps:
- name: 'Checkout'
Expand Down
37 changes: 20 additions & 17 deletions composer.json
Expand Up @@ -34,38 +34,41 @@
"pagerfanta/pagerfanta": "^2.4 || ^3.0 || ^4.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"ruflin/elastica": "^7.1",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/property-access": "^4.4 || ^5.4 || ^6.2"
"symfony/console": "^5.4 || ^6.3 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.3 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/property-access": "^5.4 || ^6.3 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.3 || ^7.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.1.1",
"doctrine/mongodb-odm": "^2.2",
"doctrine/orm": "^2.8",
"doctrine/phpcr-odm": "^1.4",
"doctrine/phpcr-odm": "^1.5.3 || ^2.0.0-beta2",
"ergebnis/composer-normalize": "^2.28",
"friendsofphp/php-cs-fixer": "^3.0",
"jackalope/jackalope-doctrine-dbal": "^1.2",
"jackalope/jackalope-doctrine-dbal": "^1.2 || ^2.0.0-RC1",
"jms/serializer": "^3.8",
"jms/serializer-bundle": "^3.5 || ^4.0",
"knplabs/knp-components": "^2.4 || ^3.0",
"jms/serializer-bundle": "^4.0 || ^5.0",
"knplabs/knp-components": "^2.4 || ^3.0 || ^4.0",
"php-cs-fixer/shim": "3.8.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-symfony": "^1.2",
"phpunit/phpunit": "^9.5",
"symfony/expression-language": "^4.4 || ^5.4 || ^6.2",
"symfony/messenger": "^4.4 || ^5.4 || ^6.2",
"symfony/serializer": "^4.4 || ^5.4 || ^6.2",
"symfony/twig-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/yaml": "^4.4 || ^5.4 || ^6.2"
"symfony/expression-language": "^5.4 || ^6.3 || ^7.0",
"symfony/messenger": "^5.4 || ^6.3 || ^7.0",
"symfony/serializer": "^5.4 || ^6.3 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/yaml": "^5.4 || ^6.3 || ^7.0"
},
"suggest": {
"enqueue/elastica-bundle": "For populating Elasticsearch indexes asynchronously and using significanly less resources. Uses Enqueue.",
"symfony/messenger": "For populating Elasticsearch indexes asynchronously and using significanly less resources."
},
"minimum-stability": "RC",
"prefer-stable": true,
"autoload": {
"psr-4": {
"FOS\\ElasticaBundle\\": "src/"
Expand All @@ -78,8 +81,8 @@
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true,
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true
}
},
"extra": {
Expand Down
2 changes: 2 additions & 0 deletions phpstan.dist.neon
Expand Up @@ -8,6 +8,8 @@ parameters:
paths:
- src
# - tests
excludePaths:
- src/Message/Handler/AsyncPersistPageHandler.php
ignoreErrors:
- message: /Trying to mock an undefined method/
path: tests/
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/ConfigManager.php
Expand Up @@ -18,6 +18,7 @@ class ConfigManager implements ManagerInterface
{
/**
* @var IndexConfig[]
*
* @phpstan-var array<string, IndexConfigInterface>
*/
private $indexes = [];
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/IndexConfigInterface.php
Expand Up @@ -69,6 +69,7 @@ public function getNumericDetection(): ?bool;

/**
* @return string|bool|null
*
* @phpstan-return ?TDynamic
*/
public function getDynamic();
Expand Down
6 changes: 6 additions & 0 deletions src/Configuration/IndexConfigTrait.php
Expand Up @@ -48,21 +48,27 @@ trait IndexConfigTrait
* An array of settings sent to ElasticSearch when creating the index.
*
* @var array
*
* @phpstan-var TSettings
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $settings;

/**
* @var array
*
* @phpstan-var TConfig
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $config;

/**
* @var array
*
* @phpstan-var TMapping
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $mapping;
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration/Source/ContainerSource.php
Expand Up @@ -25,6 +25,7 @@ class ContainerSource implements SourceInterface
* The internal container representation of information.
*
* @var array
*
* @phpstan-var list<TConfig>
*/
private $configArray;
Expand All @@ -41,6 +42,7 @@ public function __construct(array $configArray)
* Should return all configuration available from the data source.
*
* @return IndexConfig[]
*
* @phpstan-return array<string, IndexConfig>
*/
public function getConfiguration(): array
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/Source/SourceInterface.php
Expand Up @@ -23,6 +23,7 @@ interface SourceInterface
* Should return all configuration available from the data source.
*
* @return \FOS\ElasticaBundle\Configuration\IndexConfig[]
*
* @phpstan-return array<string, IndexConfigInterface>
*/
public function getConfiguration(): array;
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration/Source/TemplateContainerSource.php
Expand Up @@ -25,6 +25,7 @@ class TemplateContainerSource implements SourceInterface
* The internal container representation of information.
*
* @var array
*
* @phpstan-var list<TConfig>
*/
private $configArray;
Expand All @@ -41,6 +42,7 @@ public function __construct(array $configArray)
* Should return all configuration available from the data source.
*
* @return IndexTemplateConfig[]
*
* @phpstan-return array<string, IndexTemplateConfig>
*/
public function getConfiguration(): array
Expand Down
3 changes: 3 additions & 0 deletions src/Configuration/TypeConfig.php
Expand Up @@ -21,12 +21,14 @@ class TypeConfig
{
/**
* @var array
*
* @phpstan-var TElasticConfig
*/
private $config;

/**
* @var array
*
* @phpstan-var TMapping
*/
private $mapping;
Expand All @@ -38,6 +40,7 @@ class TypeConfig

/**
* @param TMapping $mapping
*
* @phpstan-param TElasticConfig $config
*/
public function __construct(string $name, array $mapping, array $config = [])
Expand Down
6 changes: 0 additions & 6 deletions src/DataCollector/ElasticaDataCollector.php
Expand Up @@ -39,17 +39,11 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
$this->data['queries'] = $this->logger->getQueries();
}

/**
* @return mixed
*/
public function getQueryCount()
{
return $this->data['nb_queries'];
}

/**
* @return mixed
*/
public function getQueries()
{
return $this->data['queries'];
Expand Down
4 changes: 3 additions & 1 deletion src/DependencyInjection/FOSElasticaExtension.php
Expand Up @@ -41,6 +41,7 @@ class FOSElasticaExtension extends Extension
* An array of indexes as configured by the extension.
*
* @var array
*
* @phpstan-var array<string, TIndexConfig>
*/
private $indexConfigs = [];
Expand All @@ -49,6 +50,7 @@ class FOSElasticaExtension extends Extension
* An array of index templates as configured by the extension.
*
* @var array
*
* @phpstan-var array<string, TIndexTemplateConfig>
*/
private $indexTemplateConfigs = [];
Expand Down Expand Up @@ -721,7 +723,7 @@ private function loadSerializer(array $config, ContainerBuilder $container): voi
$serializer = $container->getDefinition('fos_elastica.serializer_callback_prototype');
$serializer->setClass($config['callback_class']);

if (\is_subclass_of($config['callback_class'], ContainerAwareInterface::class)) {
if (\class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface') && \is_subclass_of($config['callback_class'], ContainerAwareInterface::class)) {
$serializer->addMethodCall('setContainer', [new Reference('service_container')]);
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/AbstractElasticaToModelTransformer.php
Expand Up @@ -144,9 +144,6 @@ public function hybridTransform(array $elasticaObjects)
return $result;
}

/**
* {@inheritdoc}
*/
public function getIdentifierField(): string
{
return $this->options['identifier'];
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/MongoDBPagerProvider.php
Expand Up @@ -37,9 +37,6 @@ public function __construct(
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/ORMPagerProvider.php
Expand Up @@ -41,9 +41,6 @@ public function __construct(
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand Down
5 changes: 1 addition & 4 deletions src/Doctrine/PHPCRPagerProvider.php
Expand Up @@ -55,9 +55,6 @@ public function __construct(ManagerRegistry $doctrine, RegisterListenersService
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand All @@ -73,7 +70,7 @@ public function provide(array $options = []): PagerInterface
$repository = $manager->getRepository($this->objectClass);

$adapter = new QueryAdapter(
\call_user_func([$repository, $options['query_builder_method']], static::ENTITY_ALIAS)
\call_user_func([$repository, $options['query_builder_method']], self::ENTITY_ALIAS)
);

$pager = new PagerfantaPager(new Pagerfanta($adapter));
Expand Down
10 changes: 6 additions & 4 deletions src/Doctrine/RepositoryManager.php
Expand Up @@ -35,9 +35,6 @@ public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerI
$this->repositoryManager = $repositoryManager;
}

/**
* {@inheritdoc}
*/
public function addIndex(string $indexName, FinderInterface $finder, ?string $repositoryName = null): void
{
throw new \LogicException(__METHOD__.' should not be called. Call addIndex on the main repository manager');
Expand All @@ -58,7 +55,12 @@ public function getRepository(string $entityName): Repository
$realEntityName = $entityName;
if (false !== \strpos($entityName, ':')) {
[$namespaceAlias, $simpleClassName] = \explode(':', $entityName);
$realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName;
// @link https://github.com/doctrine/persistence/pull/204
if (\method_exists($this->managerRegistry, 'getAliasNamespace')) {
$realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName;
} else {
$realEntityName = $simpleClassName.'::class';
}
}

if (isset($this->entities[$realEntityName])) {
Expand Down
2 changes: 0 additions & 2 deletions src/Elastica/Client.php
Expand Up @@ -49,8 +49,6 @@ class Client extends BaseClient
private $stopwatch;

/**
* {@inheritdoc}
*
* @param array<mixed> $data
* @param array<mixed> $query
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Event/AbstractIndexPopulateEvent.php
Expand Up @@ -37,6 +37,7 @@ abstract class AbstractIndexPopulateEvent extends AbstractIndexEvent

/**
* @var array
*
* @phpstan-var TOptions
*/
protected $options;
Expand Down Expand Up @@ -67,8 +68,6 @@ public function getOptions(): array

/**
* @throws \InvalidArgumentException if option does not exist
*
* @return mixed
*/
public function getOption(string $name)
{
Expand Down