Skip to content

Commit 4e684e0

Browse files
authored
Merge pull request #10 from Jakub-Fajkus/php-81
PHP 8.1
2 parents 06e6c93 + 3631769 commit 4e684e0

File tree

10 files changed

+30
-113
lines changed

10 files changed

+30
-113
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
php: [ 7.4 ]
12+
php: [ 7.4, 8.0, 8.1 ]
1313
version: [ lowest, standard ]
1414
elastic: [ 7.12.1 ]
1515

@@ -51,7 +51,6 @@ jobs:
5151
name: PHPStan standard
5252
run: make phpstan
5353

54-
- if: matrix.php == '7.4'
55-
name: Tests
54+
- name: Tests
5655
run: make tests
5756

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

composer.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@
2727
"php": ">=7.4",
2828
"ext-json": "*",
2929
"ext-curl": "*",
30-
"spameri/elastic-query": "^v1.0.0-alpha.10",
31-
"elasticsearch/elasticsearch": "^2.4.0 || ^7.12.0",
32-
"nette/di": "^2.4.17 || ^3.0",
33-
"nette/utils": "^2.5.7 || ^3.0",
34-
"kdyby/console": "^2.7.1 || ^2.8.0",
35-
"symfony/console": "^4",
30+
"spameri/elastic-query": "^v1.0.0-alpha.13",
31+
"elasticsearch/elasticsearch": "^7.12.0",
32+
"nette/di": "^3.0.5",
33+
"nette/utils": "^3.2.5",
34+
"symfony/console": "^4.4.26",
3635
"tracy/tracy": "^2.6.7",
3736
"monolog/monolog": "^2.0.2",
38-
"ezimuel/ringphp": "^1.1.2"
37+
"ezimuel/ringphp": "^1.2"
3938
},
4039
"require-dev": {
4140
"spameri/coding-standard": "dev-master",
4241
"spameri/dependency-mocker": "^1.3",
4342
"nette/tester": "^2.4",
4443
"phpstan/phpstan": "0.12.84",
4544
"php-coveralls/php-coveralls": "^2.1",
46-
"nette/bootstrap": "~2.4.6 || ^3.0",
47-
"nette/http": "^2.4.12 || ^3.0",
48-
"mockery/mockery": "^1.2"
45+
"nette/bootstrap": "^3.0",
46+
"nette/http": "^3.0.7",
47+
"kdyby/console": "^4.0.0",
48+
"mockery/mockery": "^1.5"
4949
},
5050
"autoload": {
5151
"psr-4": {
@@ -56,5 +56,10 @@
5656
"psr-4": {
5757
"SpameriTests\\": "tests/SpameriTests"
5858
}
59+
},
60+
"config": {
61+
"allow-plugins": {
62+
"dealerdirect/phpcodesniffer-composer-installer": true
63+
}
5964
}
6065
}

phpstan-low.neon

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ parameters:
1111
ignoreErrors:
1212
- '#PHPDoc tag \@throws with type Elasticsearch\\Common\\Exceptions\\ElasticsearchException is not subtype of Throwable#'
1313
- '#Call to function array_key_exists\(\) with string and array<int, mixed> will always evaluate to false.#'
14-
-
15-
message: "#^Call to method addSetup\\(\\) on an unknown class Nette\\\\DI\\\\Definitions\\\\ServiceDefinition\\.$#"
16-
count: 1
17-
path: src/DI/SpameriElasticSearchExtension.php
18-
19-
-
20-
message: "#^PHPDoc tag @var for variable \\$definition contains unknown class Nette\\\\DI\\\\Definitions\\\\ServiceDefinition\\.$#"
21-
count: 1
22-
path: src/DI/SpameriElasticSearchExtension.php
2314

2415
-
2516
message: "#^Method Spameri\\\\Elastic\\\\Diagnostics\\\\PanelLogger\\:\\:emergency\\(\\) should return null but return statement is missing\\.$#"

phpstan.neon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ parameters:
2929
path: src/Model/TypeToNewIndex/Migrate.php
3030

3131
-
32-
message: "#^Static method Nette\\\\DI\\\\Compiler\\:\\:loadDefinitions\\(\\) invoked with 3 parameters, 0 required\\.$#"
33-
count: 1
34-
path: src/DI/SpameriElasticSearchExtension.php
32+
message: "#^Unable to resolve the template type T in call to method Nette\\\\DI\\\\Container\\:\\:getByType\\(\\)$#"
33+
count: 2
34+
path: src/Model/ServiceLocator.php
3535

3636

3737
checkGenericClassInNonGenericObjectType: false

src/DI/SpameriElasticSearchExtension.php

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,17 @@ public function loadConfiguration(): void
3131

3232
$services = $this->toggleDebugBar($config, $services);
3333

34-
if ( ! \class_exists(\Symfony\Component\Console\Command\Command::class)) {
35-
$services = $this->removeCommandDefinitions($services);
36-
}
37-
3834
$services = $this->setConfigOptions($services, $config);
3935

40-
if (\method_exists($this->compiler, 'loadDefinitionsFromConfig')) {
41-
$aliasedServices = [];
42-
foreach ($services['services'] as $key => $service) {
43-
$aliasedServices['spameriElasticSearch.' . $key] = $service;
44-
}
36+
$aliasedServices = [];
37+
foreach ($services['services'] as $key => $service) {
38+
$aliasedServices['spameriElasticSearch.' . $key] = $service;
39+
}
4540

46-
$this->compiler->loadDefinitionsFromConfig(
47-
$aliasedServices
48-
);
41+
$this->compiler->loadDefinitionsFromConfig(
42+
$aliasedServices
43+
);
4944

50-
} else {
51-
$this->compiler::loadDefinitions(
52-
$this->getContainerBuilder(),
53-
$services['services'],
54-
$this->name
55-
);
56-
}
5745
}
5846

5947

@@ -104,27 +92,4 @@ public function toggleDebugBar(
10492
return $services;
10593
}
10694

107-
108-
/**
109-
* @param array<mixed> $services
110-
* @return array<mixed>
111-
*/
112-
public function removeCommandDefinitions(
113-
array $services
114-
): array
115-
{
116-
$iterableServices = $services['services'];
117-
foreach ($iterableServices as $serviceKey => $serviceArray) {
118-
if (isset($serviceArray['tags'])) {
119-
foreach ($serviceArray['tags'] as $tag) {
120-
if ($tag === 'kdyby.console.command') {
121-
unset($services[$serviceKey]);
122-
}
123-
}
124-
}
125-
}
126-
127-
return $services;
128-
}
129-
13095
}

src/Entity/Collection/AbstractElasticEntityCollection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function initialize(): void
7272
$entities = $this->service->getAllBy(
7373
new \Spameri\ElasticQuery\ElasticQuery(
7474
new \Spameri\ElasticQuery\Query\QueryCollection(
75+
NULL,
7576
new \Spameri\ElasticQuery\Query\MustCollection(
7677
new \Spameri\ElasticQuery\Query\Terms(
7778
'_id',

src/Entity/DateTimeInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
interface DateTimeInterface extends \DateTimeInterface
66
{
77

8+
#[\ReturnTypeWillChange]
89
public function format($format = NULL);
910

1011
}

src/Entity/Property/DateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class DateTime extends \Nette\Utils\DateTime implements \Spameri\Elastic\Entity\
1313
* @param string|null $format
1414
* @return string
1515
*/
16+
#[\ReturnTypeWillChange]
1617
public function format($format = NULL)
1718
{
1819
if (\is_null($format)) {

src/Model/Indices/GetFieldMapping.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ class GetFieldMapping
77

88
private \Spameri\Elastic\ClientProvider $clientProvider;
99

10-
private \Spameri\Elastic\Model\VersionProvider $versionProvider;
11-
1210

1311
public function __construct(
1412
\Spameri\Elastic\ClientProvider $clientProvider

0 commit comments

Comments
 (0)