Skip to content

Commit

Permalink
Fix tests to account for issues newer Psalm detects
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed May 29, 2021
1 parent 30ca25c commit fd669c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<issueHandlers>
<LessSpecificReturnType errorLevel="info" />
<UnnecessaryVarAnnotation errorLevel="suppress" />
</issueHandlers>

<plugins>
Expand Down
1 change: 1 addition & 0 deletions src/VersionUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

abstract class VersionUtils
{
/** @param "!="|"<"|"<="|"<>"|"="|"=="|">"|">=" $op */
public static function packageVersionIs(string $package, string $op, string $ref): bool
{
try {
Expand Down
12 changes: 6 additions & 6 deletions tests/acceptance/Prophecy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Prophecy
{
/** @return void */
public function testSomething() {
$argument = Argument::that(function () {
$_argument = Argument::that(function () {
return true;
});
}
Expand All @@ -49,7 +49,7 @@ Feature: Prophecy
{
/** @return void */
public function testSomething() {
$argument = Argument::that(function (int $i) {
$_argument = Argument::that(function (int $i) {
return $i > 0;
});
}
Expand All @@ -65,7 +65,7 @@ Feature: Prophecy
{
/** @return void */
public function testSomething() {
$argument = Argument::that(function (int $i, int $j, int $k) {
$_argument = Argument::that(function (int $i, int $j, int $k) {
return ($i + $j + $k) > 0;
});
}
Expand All @@ -81,16 +81,16 @@ Feature: Prophecy
{
/** @return void */
public function testSomething() {
$argument = Argument::that(function (): string {
$_argument = Argument::that(function (): string {
return 'hello';
});
}
}
"""
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidScalarArgument | /Argument 1 of Prophecy\\Argument::that expects callable\(mixed...\):bool, (pure-)?Closure\(\):string\(hello\) provided/ |
| Type | Message |
| InvalidScalarArgument | /Argument 1 of Prophecy\\Argument::that expects callable\(mixed...\):bool, (pure-)?Closure\(\):(string\(hello\)\|"hello") provided/ |
And I see no other errors

Scenario: prophesize() provided by ProphecyTrait is generic
Expand Down

0 comments on commit fd669c6

Please sign in to comment.