Skip to content

Commit dfd2296

Browse files
committed
Added support for Symfony 6
1 parent a8a3268 commit dfd2296

21 files changed

+548
-553
lines changed

.github/workflows/phpunit-tests.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,39 @@ jobs:
4848
- 'highest'
4949
php:
5050
- '8.1'
51-
- '8.2'
51+
- '8.3'
5252
elasticsearch:
53-
- '7.17.13'
53+
- '7.17.24'
5454
symfony:
55-
- '~5.0'
55+
- '~6.0'
5656
include:
57-
- php: '8.1'
58-
symfony: '~5.0'
57+
- php: '8.3'
58+
symfony: '~6.0'
5959
elasticsearch: '8.0.1'
6060
experimental: false
61-
- php: '8.1'
62-
symfony: '~5.0'
61+
- php: '8.3'
62+
symfony: '~6.0'
6363
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
6464
experimental: false
65-
- php: '8.1'
66-
symfony: '~5.0'
65+
- php: '8.3'
66+
symfony: '~6.0'
6767
elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html
6868
experimental: false
69-
- php: '8.1'
70-
symfony: '~5.0'
69+
- php: '8.3'
70+
symfony: '~6.0'
7171
elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html
7272
experimental: false
73-
- php: '8.1'
74-
symfony: '~5.0'
73+
- php: '8.3'
74+
symfony: '~6.0'
7575
elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html
7676
experimental: false
77-
- php: '8.1'
78-
symfony: '~5.0'
77+
- php: '8.3'
78+
symfony: '~6.0'
7979
elasticsearch: '8.8.0' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html
8080
experimental: false
8181
- php: '8.1'
82-
symfony: '~6.0'
83-
elasticsearch: '8.10.2' # newest version
82+
symfony: '~5.0'
83+
elasticsearch: '8.15.2' # newest version
8484
experimental: false
8585
fail-fast: false
8686
steps:
@@ -115,7 +115,7 @@ jobs:
115115

116116
- name: 'Run phpunit tests'
117117
run: |
118-
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml 2>/dev/null
118+
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml
119119
120120
- name: Upload coverage results to Coveralls
121121
env:

composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@
1414
"php": "^7.3 || ^8.0",
1515
"psr/log": "^1.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",
17+
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
18+
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0",
19+
"symfony/config": "^4.4 || ^5.0 || ^6.0",
20+
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0",
21+
"symfony/translation": "^4.4 || ^5.0 || ^6.0",
22+
"symfony/console": "^4.4 || ^5.0 || ^6.0",
23+
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0",
2424
"symfony/event-dispatcher-contracts": "^1.1 || ^2.2",
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/debug": "^4.4 || ^5.0 || ^6.0",
32+
"symfony/stopwatch": "^4.4 || ^5.0 || ^6.0",
33+
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
34+
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
35+
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0",
3636
"doctrine/orm": "^2.6.3",
3737

3838
"monolog/monolog": "^1.0|^2.0|^3.0",

src/Annotation/DocObject.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Annotation to mark a class as an object during the parsing process.
77
*
88
* @Annotation
9-
*
109
* @Target("CLASS")
1110
*/
1211
final class DocObject

src/Annotation/Document.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* Annotation to mark a class as an Elasticsearch document.
99
*
1010
* @Annotation
11-
*
1211
* @Target("CLASS")
1312
*/
1413
final class Document implements DumperInterface

src/Annotation/Id.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Annotation used for the meta _id field
77
*
88
* @Annotation
9-
*
109
* @Target("PROPERTY")
1110
*/
1211
final class Id

src/Annotation/Property.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* Annotation used to check mapping type during the parsing process.
99
*
1010
* @Annotation
11-
*
1211
* @Target("PROPERTY")
1312
*/
1413
final class Property implements DumperInterface

src/Annotation/Score.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Annotation used for the meta _score field, returned when searching
77
*
88
* @Annotation
9-
*
109
* @Target("PROPERTY")
1110
*/
1211
final class Score

src/Document/Provider/ElasticsearchProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ElasticsearchProvider extends AbstractProvider
4545
public function __construct(
4646
DocumentMetadataCollector $metadataCollector,
4747
IndexManager $sourceIndexManager,
48-
string $sourceDocumentClass
48+
string $sourceDocumentClass,
4949
) {
5050
$this->metadataCollector = $metadataCollector;
5151
$this->sourceIndexManager = $sourceIndexManager;

src/Document/Provider/ProviderRegistry.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
ServiceLocator $serviceLocator,
3939
DocumentMetadataCollector $documentMetadataCollector,
4040
IndexManagerRegistry $indexManagerRegistry,
41-
string $selfProviderClass
41+
string $selfProviderClass,
4242
) {
4343
$this->serviceLocator = $serviceLocator;
4444
$this->documentMetadataCollector = $documentMetadataCollector;

src/Document/Repository/Repository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getById(string $id, int $resultType = Finder::RESULTS_OBJECT)
6565
*
6666
* @return mixed
6767
*/
68-
public function find(array $searchBody, int $resultsType = Finder::RESULTS_OBJECT, array $additionalRequestParams = [], int &$totalHits = null)
68+
public function find(array $searchBody, int $resultsType = Finder::RESULTS_OBJECT, array $additionalRequestParams = [], ?int &$totalHits = null)
6969
{
7070
return $this->finder->find([$this->documentClass], $searchBody, $resultsType, $additionalRequestParams, $totalHits);
7171
}

src/Exception/IndexOrAliasNotFoundException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class IndexOrAliasNotFoundException extends Exception
1717
*
1818
* @param int $code
1919
*/
20-
public function __construct(string $indexOrAlias, bool $isAlias = false, $code = 0, \Throwable $previous = null)
20+
public function __construct(string $indexOrAlias, bool $isAlias = false, $code = 0, ?\Throwable $previous = null)
2121
{
2222
$this->indexOrAlias = $indexOrAlias;
2323

src/Exception/IndexRebuildingException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IndexRebuildingException extends Exception
1616
* @param array $indicesInProgress The physical indices, which are in the process of being built
1717
* @param int $code
1818
*/
19-
public function __construct(array $indicesInProgress, $code = 0, Exception $previous = null)
19+
public function __construct(array $indicesInProgress, $code = 0, ?Exception $previous = null)
2020
{
2121
parent::__construct(\sprintf('Index is currently being rebuilt as "%s"', \implode(', ', $indicesInProgress)), $code, $previous);
2222

src/Finder/Finder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Finder
4848
public function __construct(
4949
DocumentMetadataCollector $documentMetadataCollector,
5050
IndexManagerRegistry $indexManagerRegistry,
51-
DocumentConverter $documentConverter
51+
DocumentConverter $documentConverter,
5252
) {
5353
$this->documentMetadataCollector = $documentMetadataCollector;
5454
$this->indexManagerRegistry = $indexManagerRegistry;
@@ -154,7 +154,7 @@ public function find(array $documentClasses, array $searchBody, $resultsType = s
154154
*
155155
* @return mixed
156156
*/
157-
public function scroll(array $documentClasses, string &$scrollId, string $scrollTime = self::SCROLL_TIME, int $resultsType = self::RESULTS_OBJECT, int &$totalHits = null)
157+
public function scroll(array $documentClasses, string &$scrollId, string $scrollTime = self::SCROLL_TIME, int $resultsType = self::RESULTS_OBJECT, ?int &$totalHits = null)
158158
{
159159
$client = $this->getConnection($documentClasses)->getClient();
160160

@@ -235,7 +235,7 @@ public function getTargetIndices(array $documentClasses): array
235235
*
236236
* @return array|DocumentIterator
237237
*/
238-
public function parseResult(array $raw, int $resultsType, array $documentClasses = null)
238+
public function parseResult(array $raw, int $resultsType, ?array $documentClasses = null)
239239
{
240240
switch ($resultsType & self::BITMASK_RESULT_TYPES) {
241241
case self::RESULTS_OBJECT:

src/Manager/IndexManager.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function __construct(
105105
ProviderRegistry $providerRegistry,
106106
Finder $finder,
107107
DocumentConverter $documentConverter,
108-
RepositoryFactory $repositoryFactory
108+
RepositoryFactory $repositoryFactory,
109109
) {
110110
$this->managerName = $managerName;
111111
$this->connection = $connection;
@@ -601,7 +601,7 @@ public function persistRaw(array $documentArray, array $metaParams = [])
601601
/**
602602
* Created a new index with a unique name
603603
*/
604-
protected function createNewIndexWithUniqueName(string $suffix = null): string
604+
protected function createNewIndexWithUniqueName(?string $suffix = null): string
605605
{
606606
$settings = $this->getIndexMapping();
607607
$newIndex = $this->getUniqueIndexName($suffix);

src/Mapping/DocumentParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private function getProperties(\ReflectionClass $documentReflection, array $inde
311311
*
312312
* @throws \ReflectionException
313313
*/
314-
private function getPropertyMapping(Property $propertyAnnotation, string $language = null, array $indexAnalyzers = [])
314+
private function getPropertyMapping(Property $propertyAnnotation, ?string $language = null, array $indexAnalyzers = [])
315315
{
316316
$propertyMapping = $propertyAnnotation->dump([
317317
'language' => $language,

src/Profiler/ElasticsearchProfiler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function addLogger(Logger $logger)
4444
/**
4545
* {@inheritDoc}
4646
*/
47-
public function collect(Request $request, Response $response, \Throwable $exception = null)
47+
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
4848
{
4949
$this->data['indexManagers'] = $this->cloneVar($this->indexManagers);
5050

tests/App/AppKernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AppKernel extends Kernel
2020
*
2121
* @return array
2222
*/
23-
public function registerBundles()
23+
public function registerBundles(): iterable
2424
{
2525
$bundles = [
2626
new FrameworkBundle(),

0 commit comments

Comments
 (0)