Skip to content

Commit 7abd04f

Browse files
committed
Added support for Symfony^6.4
Removed support for PHP<8.1 Removed support for Symfony<5.4 Removed support for Monolog 1.*
1 parent a8a3268 commit 7abd04f

File tree

60 files changed

+918
-1433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+918
-1433
lines changed

.github/workflows/phpunit-tests.yml

+29-18
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,44 @@ jobs:
4848
- 'highest'
4949
php:
5050
- '8.1'
51-
- '8.2'
51+
- '8.3'
5252
elasticsearch:
53-
- '7.17.13'
53+
- '7.17.24'
54+
- '8.15.2'
5455
symfony:
55-
- '~5.0'
56+
- '~6.0'
5657
include:
57-
- php: '8.1'
58-
symfony: '~5.0'
58+
- php: '8.3'
59+
symfony: '~6.0'
5960
elasticsearch: '8.0.1'
6061
experimental: false
61-
- php: '8.1'
62-
symfony: '~5.0'
62+
- php: '8.3'
63+
symfony: '~6.0'
64+
elasticsearch: '8.0.1'
65+
experimental: false
66+
- php: '8.3'
67+
symfony: '~6.0'
6368
elasticsearch: '8.1.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.1.html#breaking-changes-8.1
6469
experimental: false
65-
- php: '8.1'
66-
symfony: '~5.0'
70+
- php: '8.3'
71+
symfony: '~6.0'
6772
elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html
6873
experimental: false
69-
- php: '8.1'
70-
symfony: '~5.0'
74+
- php: '8.3'
75+
symfony: '~6.0'
7176
elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html
7277
experimental: false
73-
- php: '8.1'
74-
symfony: '~5.0'
78+
- php: '8.3'
79+
symfony: '~6.0'
7580
elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html
7681
experimental: false
77-
- php: '8.1'
78-
symfony: '~5.0'
82+
- php: '8.3'
83+
symfony: '~6.0'
7984
elasticsearch: '8.8.0' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html
8085
experimental: false
8186
- php: '8.1'
82-
symfony: '~6.0'
83-
elasticsearch: '8.10.2' # newest version
87+
symfony: '~5.0'
88+
elasticsearch: '8.15.2' # newest version
8489
experimental: false
8590
fail-fast: false
8691
steps:
@@ -115,10 +120,16 @@ jobs:
115120

116121
- name: 'Run phpunit tests'
117122
run: |
118-
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml 2>/dev/null
123+
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml
119124
120125
- name: Upload coverage results to Coveralls
121126
env:
122127
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
123128
run: |
124129
vendor/bin/php-coveralls --coverage_clover=tests/App/build/clover.xml --json_path=tests/App/build/coveralls.json -v
130+
131+
# Enable tmate debugging on failure for 15 minutes
132+
- name: Setup tmate session
133+
if: ${{ !env.ACT && failure() }}
134+
uses: mxschmitt/action-tmate@v3
135+
timeout-minutes: 15

.php-cs-fixer.dist.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Indent '=>' operator
1818
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal']],
1919
// PSR12 imports order
20-
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
20+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
21+
'phpdoc_separation' => true,
2122
])
2223
;

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Installation instructions and documentation of the bundle can be found [here](do
2121
## Version matrix
2222

2323
| ElasticsearchBundle | Elasticsearch | Symfony | PHP |
24-
| ------------------- | -------------- | ----------- | ----------- |
24+
|---------------------| -------------- |-------------|-------------|
25+
| ~7.2 | >= 7.0 | 5.0+ | 8.1+ |
2526
| ~7.0 | >= 7.0 | 4.4+ / 5.0+ | 7.3+ / 8.0+ |
2627
| ~6.2 | >= 6.2, < 7.0 | 3.4+ / 4.0+ | 7.3+ |
2728
| ~6.1.0 | >= 6.0, < 6.2 | | |

composer.json

+15-16
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,30 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.3 || ^8.0",
15-
"psr/log": "^1.0",
14+
"php": "^8.1",
15+
"psr/log": "^2.0 || ^3.0",
1616

17-
"symfony/framework-bundle": "^4.4 || ^5.0",
18-
"symfony/options-resolver": "^4.4 || ^5.0",
19-
"symfony/config": "^4.4 || ^5.0",
20-
"symfony/event-dispatcher": "^4.4 || ^5.0",
21-
"symfony/translation": "^4.4 || ^5.0",
22-
"symfony/console": "^4.4 || ^5.0",
23-
"symfony/http-kernel": "^4.4 || ^5.0",
24-
"symfony/event-dispatcher-contracts": "^1.1 || ^2.2",
17+
"symfony/framework-bundle": "^5.4 || ^6.4",
18+
"symfony/options-resolver": "^5.4 || ^6.4",
19+
"symfony/config": "^5.4 || ^6.4",
20+
"symfony/event-dispatcher": "^5.4 || ^6.4",
21+
"symfony/translation": "^5.4 || ^6.4",
22+
"symfony/console": "^5.4 || ^6.4",
23+
"symfony/http-kernel": "^5.4 || ^6.4",
24+
"symfony/event-dispatcher-contracts": "^3.5",
2525

2626
"doctrine/annotations": "^1.2",
2727
"doctrine/cache": "^1.4",
2828
"elasticsearch/elasticsearch": "^7.0"
2929
},
3030
"require-dev": {
31-
"symfony/debug": "^4.4 || ^5.0",
32-
"symfony/stopwatch": "^4.4 || ^5.0",
33-
"symfony/phpunit-bridge": "^4.4 || ^5.0",
34-
"symfony/browser-kit": "^4.4 || ^5.0",
35-
"symfony/dotenv": "^4.4 || ^5.0",
31+
"symfony/stopwatch": "^5.4 || ^6.4",
32+
"symfony/phpunit-bridge": "^5.4 || ^6.4",
33+
"symfony/browser-kit": "^5.4 || ^6.4",
34+
"symfony/dotenv": "^5.4 || ^6.4",
3635
"doctrine/orm": "^2.6.3",
3736

38-
"monolog/monolog": "^1.0|^2.0|^3.0",
37+
"monolog/monolog": "^2.0|^3.0",
3938
"knplabs/knp-paginator-bundle": "^4.0 || ^5.0",
4039
"friendsofphp/php-cs-fixer": "^3.34",
4140
"php-coveralls/php-coveralls": "^2.1",

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
elasticsearch:
3-
image: "docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.17.13}"
3+
image: "docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.15.2}"
44
container_name: sfes_elasticsearch
55
environment:
66
- discovery.type=single-node

phpcs.xml

-10
This file was deleted.

src/Annotation/Document.php

+5-14
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,19 @@
1313
*/
1414
final class Document implements DumperInterface
1515
{
16-
/**
17-
* @var string
18-
*/
19-
public $repositoryClass;
20-
21-
/**
22-
* @var string
23-
*/
24-
public $providerClass;
16+
public ?string $repositoryClass = null;
17+
public ?string $providerClass = null;
2518

2619
/**
2720
* Settings directly passed to Elasticsearch client as-is
28-
*
29-
* @var array
3021
*/
31-
public $options;
22+
public array $options = [];
3223

3324
/**
3425
* {@inheritdoc}
3526
*/
36-
public function dump(array $settings = [])
27+
public function dump(array $settings = []): array
3728
{
38-
return (array) $this->options;
29+
return $this->options;
3930
}
4031
}

src/Annotation/Property.php

+8-25
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,42 @@ final class Property implements DumperInterface
1818
public const DEFAULT_LANG_SUFFIX = 'default';
1919

2020
/**
21-
* @var string
22-
*
2321
* @Required
2422
*/
25-
public $name;
23+
public string $name;
2624

2725
/**
28-
* @var string
29-
*
3026
* @Required
3127
*/
32-
public $type;
28+
public string $type;
3329

34-
/**
35-
* @var bool
36-
*/
37-
public $multilanguage;
30+
public bool $multilanguage = false;
3831

3932
/**
4033
* Override mapping for the 'default' language field of multilanguage properties
41-
*
42-
* @var array
4334
*/
44-
public $multilanguageDefaultOptions;
35+
public array $multilanguageDefaultOptions = [];
4536

4637
/**
4738
* The object name must be defined, if type is 'object' or 'nested'
48-
*
49-
* @var string Object name to map.
5039
*/
51-
public $objectName;
40+
public string $objectName;
5241

5342
/**
5443
* Defines if related object will have one or multiple values.
5544
* If this value is set to true, ObjectIterator will be provided in the result, as opposed to an ObjectInterface object
56-
*
57-
* @var bool
5845
*/
59-
public $multiple;
46+
public bool $multiple = false;
6047

6148
/**
6249
* Settings directly passed to Elasticsearch client as-is
63-
*
64-
* @var array
6550
*/
66-
public $options;
51+
public array $options = [];
6752

6853
/**
6954
* Dumps property fields as array for index mapping
70-
*
71-
* @return array
7255
*/
73-
public function dump(array $settings = [])
56+
public function dump(array $settings = []): array
7457
{
7558
$result = (array) $this->options;
7659

src/CacheWarmer/MetadataCacheWarmer.php

+4-25
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,23 @@
44

55
use Sineflow\ElasticsearchBundle\Mapping\DocumentMetadataCollector;
66
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
7-
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
87

9-
/**
10-
* Class MetadataCacheWarmer
11-
*/
128
class MetadataCacheWarmer implements CacheWarmerInterface
139
{
14-
/**
15-
* @var DocumentMetadataCollector
16-
*/
17-
private $metadataCollector;
10+
private DocumentMetadataCollector $metadataCollector;
1811

1912
public function __construct(DocumentMetadataCollector $metadataCollector)
2013
{
2114
$this->metadataCollector = $metadataCollector;
2215
}
2316

24-
/**
25-
* @return bool
26-
*/
27-
public function isOptional()
17+
public function isOptional(): bool
2818
{
2919
return true;
3020
}
3121

32-
/**
33-
* @param string $cacheDir
34-
*
35-
* @return array
36-
*
37-
* @throws \Psr\Cache\InvalidArgumentException
38-
*/
39-
public function warmUp($cacheDir)
22+
public function warmUp(string $cacheDir): array
4023
{
41-
if ($this->metadataCollector instanceof WarmableInterface) {
42-
return (array) $this->metadataCollector->warmUp($cacheDir);
43-
}
44-
45-
throw new \LogicException(\sprintf('The metadata collector "%s" cannot be warmed up because it does not implement "%s".', \get_debug_type($this->metadataCollector), WarmableInterface::class));
24+
return $this->metadataCollector->warmUp($cacheDir);
4625
}
4726
}

src/Command/IndexBuildCommand.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ class IndexBuildCommand extends Command
1616
{
1717
protected static $defaultName = 'sineflow:es:index:build';
1818

19-
/**
20-
* @var IndexManagerRegistry
21-
*/
22-
private $indexManagerRegistry;
19+
private IndexManagerRegistry $indexManagerRegistry;
2320

2421
public function __construct(IndexManagerRegistry $indexManagerRegistry)
2522
{
@@ -31,7 +28,7 @@ public function __construct(IndexManagerRegistry $indexManagerRegistry)
3128
/**
3229
* {@inheritdoc}
3330
*/
34-
protected function configure()
31+
protected function configure(): void
3532
{
3633
parent::configure();
3734

@@ -59,7 +56,7 @@ protected function configure()
5956
/**
6057
* {@inheritdoc}
6158
*/
62-
protected function execute(InputInterface $input, OutputInterface $output)
59+
protected function execute(InputInterface $input, OutputInterface $output): int
6360
{
6461
$indexManagerName = $input->getArgument('index');
6562
$indexManager = $this->indexManagerRegistry->get($indexManagerName);

src/Command/IndexCreateCommand.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ class IndexCreateCommand extends Command
1515
{
1616
protected static $defaultName = 'sineflow:es:index:create';
1717

18-
/**
19-
* @var IndexManagerRegistry
20-
*/
21-
private $indexManagerRegistry;
18+
private IndexManagerRegistry $indexManagerRegistry;
2219

2320
public function __construct(IndexManagerRegistry $indexManagerRegistry)
2421
{
@@ -30,7 +27,7 @@ public function __construct(IndexManagerRegistry $indexManagerRegistry)
3027
/**
3128
* {@inheritdoc}
3229
*/
33-
protected function configure()
30+
protected function configure(): void
3431
{
3532
parent::configure();
3633

@@ -46,7 +43,7 @@ protected function configure()
4643
/**
4744
* {@inheritdoc}
4845
*/
49-
protected function execute(InputInterface $input, OutputInterface $output)
46+
protected function execute(InputInterface $input, OutputInterface $output): int
5047
{
5148
$indexManagerName = $input->getArgument('index');
5249
$indexManager = $this->indexManagerRegistry->get($indexManagerName);

0 commit comments

Comments
 (0)