Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
[Analyzer] #185 Fix tests for ReturnAndYieldInOneMethod + yield from
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Oct 31, 2016
1 parent ec918b5 commit 09a5773
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/analyze-fixtures/Statement/ReturnAndYieldInOneMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ public function testReturnAndYield($a = true)
if ($a) {
return $a;
}

yield $a;
}

public function testReturnAndYieldFrom($a = true)
{
if ($a) {
return $a;
}

yield from [1, 2, 3, 4, 5];
}

public function testReturnOnly($a = true)
{
if ($a) {
return $a;
}

return !$a;
}

Expand All @@ -34,11 +45,19 @@ public function testVoid(&$a)
}
?>
----------------------------
PHPSA\Analyzer\Pass\Statement\ReturnAndYieldInOneMethod
----------------------------
[
{
"type": "return_and_yield_in_one_method",
"message": "Do not use return and yield in a one method",
"file": "ReturnAndYieldInOneMethod.php",
"line": 6
},
{
"type": "return_and_yield_in_one_method",
"message": "Do not use return and yield in a one method",
"file": "ReturnAndYieldInOneMethod.php",
"line": 15
}
]

0 comments on commit 09a5773

Please sign in to comment.