Skip to content

Commit

Permalink
Switch to MixedReturnStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Mar 15, 2024
1 parent ad94880 commit d024ab2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Hooks/TestCaseHandler.php
Expand Up @@ -292,7 +292,7 @@ public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event
|| $provider_return_type->type_params[0]->hasArrayKey();

if ($provider_key_type_is_uncertain) {
IssueBuffer::accepts(new Issue\MixedInferredReturnType(
IssueBuffer::accepts(new Issue\MixedReturnStatement(
'Providers must return ' . $expected_provider_return_type->getId()
. ', possibly different ' . $provider_return_type_string . ' provided',
$provider_return_type_location
Expand All @@ -314,7 +314,7 @@ public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event

if (!$provider_value_type_is_compatible) {
if ($provider_return_type->type_params[1]->hasMixed()) {
IssueBuffer::accepts(new Issue\MixedInferredReturnType(
IssueBuffer::accepts(new Issue\MixedReturnStatement(
'Providers must return ' . $expected_provider_return_type->getId()
. ', possibly different ' . $provider_return_type_string . ' provided',
$provider_return_type_location
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/TestCase.feature
Expand Up @@ -310,7 +310,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| Type | Message |
| MixedInferredReturnType | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different array<array-key, mixed> provided |
| MixedReturnStatement | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different array<array-key, mixed> provided |
And I see no other errors

Scenario: Underspecified iterable data provider is reported
Expand All @@ -334,7 +334,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| Type | Message |
| MixedInferredReturnType | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different iterable<mixed, mixed> provided |
| MixedReturnStatement | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different iterable<mixed, mixed> provided |
And I see no other errors

Scenario: Underspecified generator data provider is reported
Expand All @@ -358,7 +358,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| Type | Message |
| MixedInferredReturnType | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different Generator provided |
| MixedReturnStatement | Providers must return iterable<array-key, array<array-key, mixed>>, possibly different Generator provided |
And I see no other errors

Scenario: Valid array data provider is allowed
Expand Down

0 comments on commit d024ab2

Please sign in to comment.