Skip to content

Commit 77f901b

Browse files
committed
Fix CS
1 parent 9213c77 commit 77f901b

File tree

9 files changed

+56
-36
lines changed

9 files changed

+56
-36
lines changed

.github/workflows/tests.yml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- staging
1010
- main
1111

12+
env:
13+
fail-fast: true
14+
1215
jobs:
1316
integration-tests:
1417
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
@@ -24,27 +27,37 @@ jobs:
2427
MEILI_MASTER_KEY: masterKey
2528
MEILI_NO_ANALYTICS: true
2629
strategy:
27-
# only TEMP
28-
fail-fast: false
2930
matrix:
30-
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
31-
include:
32-
- php-version: '7.4'
33-
sf-version: '5.4.*'
34-
- php-version: '8.0'
35-
sf-version: '6.0.*'
36-
- php-version: '8.1'
37-
sf-version: '6.0.*'
38-
- php-version: '8.1'
39-
sf-version: '6.1.*'
40-
- php-version: '8.2'
41-
sf-version: '6.2.*'
42-
- php-version: '8.3'
43-
sf-version: '6.3.*'
44-
- php-version: '8.3'
45-
sf-version: '6.4.*'
46-
- php-version: '8.3'
47-
sf-version: '7.0.*'
31+
php-version: ['7.4', '8.1', '8.2', '8.3']
32+
sf-version: ['5.4.*', '6.4.*', '7.0.*']
33+
exclude:
34+
- php-version: '7.4'
35+
sf-version: '6.4.*'
36+
- php-version: '7.4'
37+
sf-version: '7.0.*'
38+
- php-version: '8.1'
39+
sf-version: '5.4.*'
40+
- php-version: '8.1'
41+
sf-version: '7.0.*'
42+
- php-version: '8.2'
43+
sf-version: '5.4.*'
44+
- php-version: '8.3'
45+
sf-version: '5.4.*'
46+
- php-version: '8.3'
47+
sf-version: '5.4.*'
48+
# include:
49+
# - php-version: '7.4'
50+
# sf-version: '5.4.*'
51+
# - php-version: '8.1'
52+
# sf-version: '6.4.*'
53+
# - php-version: '8.2'
54+
# sf-version: '6.4.*'
55+
# - php-version: '8.3'
56+
# sf-version: '6.4.*'
57+
# - php-version: '8.2'
58+
# sf-version: '7.0.*'
59+
# - php-version: '8.3'
60+
# sf-version: '7.0.*'
4861

4962
name: integration-tests (PHP ${{ matrix.php-version }}) (Symfony ${{ matrix.sf-version }})
5063
steps:
@@ -76,7 +89,7 @@ jobs:
7689
- name: Install PHP
7790
uses: shivammathur/setup-php@v2
7891
with:
79-
php-version: '8.1'
92+
php-version: 8.3
8093

8194
- name: Validate composer.json and composer.lock
8295
run: composer validate

bors.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
status = [
22
'integration-tests (PHP 7.4) (Symfony 5.4.*)',
3-
'integration-tests (PHP 8.0) (Symfony 6.0.*)',
4-
'integration-tests (PHP 8.1) (Symfony 6.1.*)',
5-
'integration-tests (PHP 8.2) (Symfony 6.2.*)',
6-
'integration-tests (PHP 8.3) (Symfony 6.3.*)',
3+
'integration-tests (PHP 8.1) (Symfony 6.4.*)',
4+
'integration-tests (PHP 8.2) (Symfony 6.4.*)',
75
'integration-tests (PHP 8.3) (Symfony 6.4.*)',
6+
'integration-tests (PHP 8.2) (Symfony 7.0.*)',
87
'integration-tests (PHP 8.3) (Symfony 7.0.*)',
98
'Code style'
109
]

src/Collection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function map(callable $callback)
6565
*
6666
* @return static
6767
*/
68-
public function filter(callable $callback = null)
68+
public function filter(?callable $callback = null)
6969
{
7070
if (null !== $callback) {
7171
return new self(array_filter($this->items, $callback, ARRAY_FILTER_USE_BOTH));
@@ -143,7 +143,7 @@ public function unique($key = null, bool $strict = false)
143143
/**
144144
* Get the first item from the collection passing the given truth test.
145145
*/
146-
public function first(callable $callback = null, $default = null)
146+
public function first(?callable $callback = null, $default = null)
147147
{
148148
if (is_null($callback)) {
149149
if (empty($this->items)) {
@@ -339,7 +339,7 @@ private static function existsInArray($array, $key): bool
339339
return array_key_exists($key, $array);
340340
}
341341

342-
private function operatorForWhere(string $key, string $operator = null, $value = null): \Closure
342+
private function operatorForWhere(string $key, ?string $operator = null, $value = null): \Closure
343343
{
344344
if (1 === func_num_args()) {
345345
$value = true;

src/Model/Aggregator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function getEntityClassFromObjectID(string $objectId): string
7373
throw new EntityNotFoundInObjectID("Entity class from ObjectID $objectId not found.");
7474
}
7575

76-
public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array
76+
public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []): array
7777
{
7878
return array_merge(['objectID' => $this->objectID], $normalizer->normalize($this->entity, $format, $context));
7979
}

src/SearchableEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
string $indexUid,
3939
$entity,
4040
ClassMetadata $entityMetadata,
41-
NormalizerInterface $normalizer = null,
41+
?NormalizerInterface $normalizer = null,
4242
array $extra = []
4343
) {
4444
$this->indexUid = $indexUid;

src/Services/MeilisearchService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class MeilisearchService implements SearchService
4242
private array $classToSerializerGroup;
4343
private array $indexIfMapping;
4444

45-
public function __construct(NormalizerInterface $normalizer, Engine $engine, array $configuration, PropertyAccessorInterface $propertyAccessor = null)
45+
public function __construct(NormalizerInterface $normalizer, Engine $engine, array $configuration, ?PropertyAccessorInterface $propertyAccessor = null)
4646
{
4747
$this->normalizer = $normalizer;
4848
$this->engine = $engine;

src/Services/UnixTimestampNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ final class UnixTimestampNormalizer implements NormalizerInterface
1111
/**
1212
* @param \DateTimeInterface $object
1313
*/
14-
public function normalize($object, string $format = null, array $context = []): int
14+
public function normalize($object, ?string $format = null, array $context = []): int
1515
{
1616
return $object->getTimestamp();
1717
}
1818

1919
/**
2020
* @param mixed $data
2121
*/
22-
public function supportsNormalization($data, string $format = null, array $context = []): bool
22+
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
2323
{
2424
return $data instanceof \DateTimeInterface && true === ($context['meilisearch'] ?? null);
2525
}

tests/BaseKernelTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function setUp(): void
4242
$this->cleanUp();
4343
}
4444

45-
protected function createPost(int $id = null): Post
45+
protected function createPost(?int $id = null): Post
4646
{
4747
$post = new Post();
4848
$post->setTitle('Test Post');
@@ -83,7 +83,7 @@ protected function createSearchablePost(): SearchableEntity
8383
);
8484
}
8585

86-
protected function createComment(int $id = null): Comment
86+
protected function createComment(?int $id = null): Comment
8787
{
8888
$post = new Post(['title' => 'What a post!']);
8989
$comment = new Comment();
@@ -101,7 +101,7 @@ protected function createComment(int $id = null): Comment
101101
return $comment;
102102
}
103103

104-
protected function createImage(int $id = null): Image
104+
protected function createImage(?int $id = null): Image
105105
{
106106
$image = new Image();
107107
$image->setUrl('https://docs.meilisearch.com/logo.png');

tests/Kernel.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,13 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
5050
],
5151
]);
5252
}
53+
54+
// @phpstan-ignore-next-line
55+
if (Kernel::VERSION_ID >= 60400) {
56+
$container->prependExtensionConfig('framework', [
57+
'handle_all_throwables' => true,
58+
'php_errors' => ['log' => true],
59+
]);
60+
}
5361
}
5462
}

0 commit comments

Comments
 (0)