Skip to content

Commit

Permalink
Merge pull request #104 from weirdan/fix-102
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Dec 10, 2020
2 parents 34e58ff + ccd317f commit a7c0014
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Hooks/TestCaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ static function (
}
$potential_argument_type = $potential_argument_types[$param_offset];

assert(null !== $param->type);
$param_type = $param->type === null ? Type::getMixed() : $param->type;
if ($param->is_variadic) {
$param_types = self::getAtomics($param->type);
$param_types = self::getAtomics($param_type);
$variadic_param_type = new Type\Union(array_values($param_types));

// check remaining argument types
Expand All @@ -411,7 +411,7 @@ static function (
break;
}

$checkParam($potential_argument_type, $param->type, $param->is_optional, $param_offset);
$checkParam($potential_argument_type, $param_type, $param->is_optional, $param_offset);
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions tests/acceptance/TestCase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,26 @@ Feature: TestCase
| Type | Message |
| InvalidDocblock | %@psalm-force-push-master% |

Scenario: Missing param type on a test with tuple data provider does not crash psalm
Given I have the following code
"""
class MyTestCase extends TestCase {
/**
* @dataProvider provide
* @psalm-suppress MissingParamType
*/
public function testSomething($data): void {}
/** @return iterable<string, array{int}> */
public function provide(): iterable {
return ['case 1' => [1]];
}
}
"""
When I run Psalm
Then I see exit code 0
And I see no errors

Scenario: Providers referenced in shorthand docblocks are not marked as unused
Given I have the following code
"""
Expand Down

0 comments on commit a7c0014

Please sign in to comment.