Skip to content

Commit fa7bda9

Browse files
authored
Upgrade psalm to version 5 (#803)
1 parent c032528 commit fa7bda9

File tree

7 files changed

+19
-24
lines changed

7 files changed

+19
-24
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@
5454
"phpstan/phpstan-strict-rules": "^1.0",
5555
"phpstan/phpstan-symfony": "^1.0",
5656
"phpunit/phpunit": "^9.6",
57-
"psalm/plugin-phpunit": "^0.17",
58-
"psalm/plugin-symfony": "^3.0",
57+
"psalm/plugin-phpunit": "^0.18",
58+
"psalm/plugin-symfony": "^4.0 || ^5.0",
5959
"rector/rector": "^0.15",
6060
"sonata-project/block-bundle": "^4.2",
6161
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
6262
"symfony/css-selector": "^4.4 || ^5.4 || ^6.2",
6363
"symfony/panther": "^1.0 || ^2.0",
6464
"symfony/phpunit-bridge": "^6.2",
65-
"vimeo/psalm": "^4.1.1"
65+
"vimeo/psalm": "^4.30 || ^5.7"
6666
},
6767
"conflict": {
6868
"sonata-project/block-bundle": "<4.2"

psalm-baseline.xml

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

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml">
2+
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" findUnusedBaselineEntry="true" findUnusedCode="false" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
33
<projectFiles>
44
<directory name="src"/>
55
<directory name="tests"/>

tests/Filter/CallbackFilterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public function customCallback(ProxyQueryInterface $proxyQuery, string $field, F
8888
return $data->hasValue();
8989
}
9090

91+
/**
92+
* @psalm-suppress InvalidArgument
93+
*/
9194
public function testFilterException(): void
9295
{
9396
$builder = new ProxyQuery($this->getQueryBuilder());

tests/Filter/DateRangeFilterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,20 @@ public function testEmpty(array $value): void
3737

3838
$builder = new ProxyQuery($queryBuilder);
3939

40-
$filter->apply($builder, FilterData::fromArray($value));
40+
$filter->apply($builder, FilterData::fromArray(['value' => $value]));
4141

4242
static::assertFalse($filter->isActive());
4343
}
4444

4545
/**
46-
* @phpstan-return iterable<array{start?: mixed, end?: mixed}>
46+
* @phpstan-return iterable<array<array{start?: mixed, end?: mixed}>>
4747
*/
4848
public function getNotApplicableValues(): iterable
4949
{
5050
return [
5151
[[]],
5252
[['end' => new \DateTime()]],
5353
[['start' => new \DateTime()]],
54-
[['start' => new \stdClass(), 'end' => new \DateTimeImmutable()]],
55-
[['start' => new \DateTimeImmutable(), 'end' => new \stdClass()]],
5654
];
5755
}
5856

tests/Filter/DateTimeRangeFilterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,20 @@ public function testEmpty(array $value): void
3737

3838
$builder = new ProxyQuery($queryBuilder);
3939

40-
$filter->apply($builder, FilterData::fromArray($value));
40+
$filter->apply($builder, FilterData::fromArray(['value' => $value]));
4141

4242
static::assertFalse($filter->isActive());
4343
}
4444

4545
/**
46-
* @phpstan-return iterable<array{start?: mixed, end?: mixed}>
46+
* @phpstan-return iterable<array<array{start?: mixed, end?: mixed}>>
4747
*/
4848
public function getNotApplicableValues(): iterable
4949
{
5050
return [
5151
[[]],
5252
[['end' => new \DateTime()]],
5353
[['start' => new \DateTime()]],
54-
[['start' => new \stdClass(), 'end' => new \DateTimeImmutable()]],
55-
[['start' => new \DateTimeImmutable(), 'end' => new \stdClass()]],
5654
];
5755
}
5856

tests/Filter/ModelFilterTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ public function testFilterScalar(): void
143143
static::assertTrue($filter->isActive());
144144
}
145145

146+
/**
147+
* @psalm-suppress InvalidArgument
148+
*/
146149
public function testAssociationWithInvalidMapping(): void
147150
{
148151
$filter = new ModelFilter();
@@ -152,9 +155,12 @@ public function testAssociationWithInvalidMapping(): void
152155

153156
$this->expectException(\RuntimeException::class);
154157

155-
$filter->apply($builder, FilterData::fromArray(['asd']));
158+
$filter->apply($builder, FilterData::fromArray(['foo']));
156159
}
157160

161+
/**
162+
* @psalm-suppress InvalidArgument
163+
*/
158164
public function testAssociationWithValidMappingAndEmptyFieldName(): void
159165
{
160166
$filter = new ModelFilter();
@@ -164,7 +170,7 @@ public function testAssociationWithValidMappingAndEmptyFieldName(): void
164170

165171
$this->expectException(\RuntimeException::class);
166172

167-
$filter->apply($builder, FilterData::fromArray(['asd']));
173+
$filter->apply($builder, FilterData::fromArray(['foo']));
168174
}
169175

170176
public function testAssociationWithValidMapping(): void

0 commit comments

Comments
 (0)