Skip to content

Commit

Permalink
Upgrade psalm to version 5 (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu authored Mar 9, 2023
1 parent c032528 commit fa7bda9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 24 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.17",
"psalm/plugin-symfony": "^3.0",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^4.0 || ^5.0",
"rector/rector": "^0.15",
"sonata-project/block-bundle": "^4.2",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.2",
"symfony/panther": "^1.0 || ^2.0",
"symfony/phpunit-bridge": "^6.2",
"vimeo/psalm": "^4.1.1"
"vimeo/psalm": "^4.30 || ^5.7"
},
"conflict": {
"sonata-project/block-bundle": "<4.2"
Expand Down
10 changes: 0 additions & 10 deletions psalm-baseline.xml

This file was deleted.

2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
Expand Down
3 changes: 3 additions & 0 deletions tests/Filter/CallbackFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public function customCallback(ProxyQueryInterface $proxyQuery, string $field, F
return $data->hasValue();
}

/**
* @psalm-suppress InvalidArgument
*/
public function testFilterException(): void
{
$builder = new ProxyQuery($this->getQueryBuilder());
Expand Down
6 changes: 2 additions & 4 deletions tests/Filter/DateRangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,20 @@ public function testEmpty(array $value): void

$builder = new ProxyQuery($queryBuilder);

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

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

/**
* @phpstan-return iterable<array{start?: mixed, end?: mixed}>
* @phpstan-return iterable<array<array{start?: mixed, end?: mixed}>>
*/
public function getNotApplicableValues(): iterable
{
return [
[[]],
[['end' => new \DateTime()]],
[['start' => new \DateTime()]],
[['start' => new \stdClass(), 'end' => new \DateTimeImmutable()]],
[['start' => new \DateTimeImmutable(), 'end' => new \stdClass()]],
];
}

Expand Down
6 changes: 2 additions & 4 deletions tests/Filter/DateTimeRangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,20 @@ public function testEmpty(array $value): void

$builder = new ProxyQuery($queryBuilder);

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

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

/**
* @phpstan-return iterable<array{start?: mixed, end?: mixed}>
* @phpstan-return iterable<array<array{start?: mixed, end?: mixed}>>
*/
public function getNotApplicableValues(): iterable
{
return [
[[]],
[['end' => new \DateTime()]],
[['start' => new \DateTime()]],
[['start' => new \stdClass(), 'end' => new \DateTimeImmutable()]],
[['start' => new \DateTimeImmutable(), 'end' => new \stdClass()]],
];
}

Expand Down
10 changes: 8 additions & 2 deletions tests/Filter/ModelFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public function testFilterScalar(): void
static::assertTrue($filter->isActive());
}

/**
* @psalm-suppress InvalidArgument
*/
public function testAssociationWithInvalidMapping(): void
{
$filter = new ModelFilter();
Expand All @@ -152,9 +155,12 @@ public function testAssociationWithInvalidMapping(): void

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

$filter->apply($builder, FilterData::fromArray(['asd']));
$filter->apply($builder, FilterData::fromArray(['foo']));
}

/**
* @psalm-suppress InvalidArgument
*/
public function testAssociationWithValidMappingAndEmptyFieldName(): void
{
$filter = new ModelFilter();
Expand All @@ -164,7 +170,7 @@ public function testAssociationWithValidMappingAndEmptyFieldName(): void

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

$filter->apply($builder, FilterData::fromArray(['asd']));
$filter->apply($builder, FilterData::fromArray(['foo']));
}

public function testAssociationWithValidMapping(): void
Expand Down

0 comments on commit fa7bda9

Please sign in to comment.