Skip to content

Commit

Permalink
Added support for Symfony 6
Browse files Browse the repository at this point in the history
  • Loading branch information
pmishev committed Dec 12, 2024
1 parent a8a3268 commit dfd2296
Show file tree
Hide file tree
Showing 21 changed files with 548 additions and 553 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,39 @@ jobs:
- 'highest'
php:
- '8.1'
- '8.2'
- '8.3'
elasticsearch:
- '7.17.13'
- '7.17.24'
symfony:
- '~5.0'
- '~6.0'
include:
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
elasticsearch: '8.0.1'
experimental: false
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
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
experimental: false
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html
experimental: false
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html
experimental: false
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html
experimental: false
- php: '8.1'
symfony: '~5.0'
- php: '8.3'
symfony: '~6.0'
elasticsearch: '8.8.0' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html
experimental: false
- php: '8.1'
symfony: '~6.0'
elasticsearch: '8.10.2' # newest version
symfony: '~5.0'
elasticsearch: '8.15.2' # newest version
experimental: false
fail-fast: false
steps:
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:

- name: 'Run phpunit tests'
run: |
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml 2>/dev/null
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml
- name: Upload coverage results to Coveralls
env:
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
"php": "^7.3 || ^8.0",
"psr/log": "^1.0",

"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/options-resolver": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/event-dispatcher": "^4.4 || ^5.0",
"symfony/translation": "^4.4 || ^5.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0",
"symfony/translation": "^4.4 || ^5.0 || ^6.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0",
"symfony/event-dispatcher-contracts": "^1.1 || ^2.2",

"doctrine/annotations": "^1.2",
"doctrine/cache": "^1.4",
"elasticsearch/elasticsearch": "^7.0"
},
"require-dev": {
"symfony/debug": "^4.4 || ^5.0",
"symfony/stopwatch": "^4.4 || ^5.0",
"symfony/phpunit-bridge": "^4.4 || ^5.0",
"symfony/browser-kit": "^4.4 || ^5.0",
"symfony/dotenv": "^4.4 || ^5.0",
"symfony/debug": "^4.4 || ^5.0 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0",
"doctrine/orm": "^2.6.3",

"monolog/monolog": "^1.0|^2.0|^3.0",
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/DocObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Annotation to mark a class as an object during the parsing process.
*
* @Annotation
*
* @Target("CLASS")
*/
final class DocObject
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Annotation to mark a class as an Elasticsearch document.
*
* @Annotation
*
* @Target("CLASS")
*/
final class Document implements DumperInterface
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Annotation used for the meta _id field
*
* @Annotation
*
* @Target("PROPERTY")
*/
final class Id
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Annotation used to check mapping type during the parsing process.
*
* @Annotation
*
* @Target("PROPERTY")
*/
final class Property implements DumperInterface
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Annotation used for the meta _score field, returned when searching
*
* @Annotation
*
* @Target("PROPERTY")
*/
final class Score
Expand Down
2 changes: 1 addition & 1 deletion src/Document/Provider/ElasticsearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ElasticsearchProvider extends AbstractProvider
public function __construct(
DocumentMetadataCollector $metadataCollector,
IndexManager $sourceIndexManager,
string $sourceDocumentClass
string $sourceDocumentClass,
) {
$this->metadataCollector = $metadataCollector;
$this->sourceIndexManager = $sourceIndexManager;
Expand Down
2 changes: 1 addition & 1 deletion src/Document/Provider/ProviderRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
ServiceLocator $serviceLocator,
DocumentMetadataCollector $documentMetadataCollector,
IndexManagerRegistry $indexManagerRegistry,
string $selfProviderClass
string $selfProviderClass,
) {
$this->serviceLocator = $serviceLocator;
$this->documentMetadataCollector = $documentMetadataCollector;
Expand Down
2 changes: 1 addition & 1 deletion src/Document/Repository/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getById(string $id, int $resultType = Finder::RESULTS_OBJECT)
*
* @return mixed
*/
public function find(array $searchBody, int $resultsType = Finder::RESULTS_OBJECT, array $additionalRequestParams = [], int &$totalHits = null)
public function find(array $searchBody, int $resultsType = Finder::RESULTS_OBJECT, array $additionalRequestParams = [], ?int &$totalHits = null)
{
return $this->finder->find([$this->documentClass], $searchBody, $resultsType, $additionalRequestParams, $totalHits);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/IndexOrAliasNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IndexOrAliasNotFoundException extends Exception
*
* @param int $code
*/
public function __construct(string $indexOrAlias, bool $isAlias = false, $code = 0, \Throwable $previous = null)
public function __construct(string $indexOrAlias, bool $isAlias = false, $code = 0, ?\Throwable $previous = null)
{
$this->indexOrAlias = $indexOrAlias;

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/IndexRebuildingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class IndexRebuildingException extends Exception
* @param array $indicesInProgress The physical indices, which are in the process of being built
* @param int $code
*/
public function __construct(array $indicesInProgress, $code = 0, Exception $previous = null)
public function __construct(array $indicesInProgress, $code = 0, ?Exception $previous = null)
{
parent::__construct(\sprintf('Index is currently being rebuilt as "%s"', \implode(', ', $indicesInProgress)), $code, $previous);

Expand Down
6 changes: 3 additions & 3 deletions src/Finder/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Finder
public function __construct(
DocumentMetadataCollector $documentMetadataCollector,
IndexManagerRegistry $indexManagerRegistry,
DocumentConverter $documentConverter
DocumentConverter $documentConverter,
) {
$this->documentMetadataCollector = $documentMetadataCollector;
$this->indexManagerRegistry = $indexManagerRegistry;
Expand Down Expand Up @@ -154,7 +154,7 @@ public function find(array $documentClasses, array $searchBody, $resultsType = s
*
* @return mixed
*/
public function scroll(array $documentClasses, string &$scrollId, string $scrollTime = self::SCROLL_TIME, int $resultsType = self::RESULTS_OBJECT, int &$totalHits = null)
public function scroll(array $documentClasses, string &$scrollId, string $scrollTime = self::SCROLL_TIME, int $resultsType = self::RESULTS_OBJECT, ?int &$totalHits = null)
{
$client = $this->getConnection($documentClasses)->getClient();

Expand Down Expand Up @@ -235,7 +235,7 @@ public function getTargetIndices(array $documentClasses): array
*
* @return array|DocumentIterator
*/
public function parseResult(array $raw, int $resultsType, array $documentClasses = null)
public function parseResult(array $raw, int $resultsType, ?array $documentClasses = null)
{
switch ($resultsType & self::BITMASK_RESULT_TYPES) {
case self::RESULTS_OBJECT:
Expand Down
4 changes: 2 additions & 2 deletions src/Manager/IndexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __construct(
ProviderRegistry $providerRegistry,
Finder $finder,
DocumentConverter $documentConverter,
RepositoryFactory $repositoryFactory
RepositoryFactory $repositoryFactory,
) {
$this->managerName = $managerName;
$this->connection = $connection;
Expand Down Expand Up @@ -601,7 +601,7 @@ public function persistRaw(array $documentArray, array $metaParams = [])
/**
* Created a new index with a unique name
*/
protected function createNewIndexWithUniqueName(string $suffix = null): string
protected function createNewIndexWithUniqueName(?string $suffix = null): string
{
$settings = $this->getIndexMapping();
$newIndex = $this->getUniqueIndexName($suffix);
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/DocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private function getProperties(\ReflectionClass $documentReflection, array $inde
*
* @throws \ReflectionException
*/
private function getPropertyMapping(Property $propertyAnnotation, string $language = null, array $indexAnalyzers = [])
private function getPropertyMapping(Property $propertyAnnotation, ?string $language = null, array $indexAnalyzers = [])
{
$propertyMapping = $propertyAnnotation->dump([
'language' => $language,
Expand Down
2 changes: 1 addition & 1 deletion src/Profiler/ElasticsearchProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function addLogger(Logger $logger)
/**
* {@inheritDoc}
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
$this->data['indexManagers'] = $this->cloneVar($this->indexManagers);

Expand Down
2 changes: 1 addition & 1 deletion tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AppKernel extends Kernel
*
* @return array
*/
public function registerBundles()
public function registerBundles(): iterable
{
$bundles = [
new FrameworkBundle(),
Expand Down
Loading

0 comments on commit dfd2296

Please sign in to comment.