Skip to content

Commit

Permalink
Merge pull request #40 from weirdan/fix-38
Browse files Browse the repository at this point in the history
Trim specials
  • Loading branch information
weirdan authored Nov 27, 2019
2 parents a2603ac + 64f821c commit 1dcd8ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hooks/TestCaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,12 @@ private static function getSpecials(ClassMethod $method): array
return [];
}
if (isset($parsed_comment['specials'])) {
return $parsed_comment['specials'];
return array_map(
function (array $lines): array {
return array_map('trim', $lines);
},
$parsed_comment['specials']
);
}
}
return [];
Expand Down
15 changes: 15 additions & 0 deletions tests/acceptance/TestCase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1047,3 +1047,18 @@ Feature: TestCase
Then I see these errors
| Type | Message |
| InvalidDocblock | %@psalm-force-push-master% |

Scenario: Providers referenced in shorthand docblocks are not marked as unused
Given I have the following code
"""
class MyTestCase extends TestCase {
/** @return iterable<string, array<int,int>> */
public function provide(): iterable {
yield "dataset name" => [1];
}
/** @dataProvider provide */
public function testSomething(int $_p): void {}
}
"""
When I run Psalm with dead code detection
Then I see no errors

0 comments on commit 1dcd8ff

Please sign in to comment.