diff --git a/examples/psalm/call.php b/examples/psalm/call.php index c929bea..390114f 100644 --- a/examples/psalm/call.php +++ b/examples/psalm/call.php @@ -9,7 +9,6 @@ use function Amp\Promise\wait; */ function accept(string $param) { - } $coroutine = call(function (): \Generator { @@ -44,5 +43,3 @@ accept(wait(call(function (): \Generator { accept(wait(call(function (): string { return 'foobar'; }))); - - diff --git a/examples/psalm/coroutine.php b/examples/psalm/coroutine.php index 9904b40..8fc446d 100644 --- a/examples/psalm/coroutine.php +++ b/examples/psalm/coroutine.php @@ -8,7 +8,6 @@ use function Amp\Promise\wait; */ function accept(string $param) { - } $coroutine = coroutine(function (): \Generator { @@ -19,5 +18,3 @@ $coroutine = coroutine(function (): \Generator { // psalm-expect InvalidScalarArgument accept(wait($coroutine())); - - diff --git a/test/PsalmTest.php b/test/PsalmTest.php index 61f432e..65fd7d6 100644 --- a/test/PsalmTest.php +++ b/test/PsalmTest.php @@ -6,24 +6,33 @@ use PHPUnit\Framework\TestCase; class PsalmTest extends TestCase { + /** + * @requires PHP >= 7.1 + */ public function test() { - $issues = \json_decode(\shell_exec('./vendor/bin/psalm --output-format=json --no-progress --config=psalm.examples.xml'), - true); + $issues = \json_decode( + \shell_exec('./vendor/bin/psalm --output-format=json --no-progress --config=psalm.examples.xml'), + true + ); foreach ($issues as $issue) { $file = \file_get_contents($issue['file_path']); $fileLines = \explode("\n", $file); if (!\preg_match('(// psalm-expect (.*))', $fileLines[$issue['line_from'] - 2] ?? '', $match)) { - $this->fail('Psalm reports an issue that isn\'t marked as expected: ' . \json_encode($issue, - \JSON_PRETTY_PRINT)); + $this->fail('Psalm reports an issue that isn\'t marked as expected: ' . \json_encode( + $issue, + \JSON_PRETTY_PRINT + )); } $expectedIssues = \array_map('trim', \explode(',', $match[1])); if (!\in_array($issue['type'], $expectedIssues, true)) { - $this->fail('Psalm reports an issue that isn\'t marked as expected: ' . \json_encode($issue, - \JSON_PRETTY_PRINT)); + $this->fail('Psalm reports an issue that isn\'t marked as expected: ' . \json_encode( + $issue, + \JSON_PRETTY_PRINT + )); } }