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

Commit

Permalink
Update the unit tests where phan itself changed analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonAndre committed Feb 21, 2018
1 parent 6790dd3 commit 9220812
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions tests/expected/all_output.expected
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ src/000_all.php:327 PhanPluginUnusedVariable Variable is never used: $thirteen
src/000_all.php:437 PhanPluginUnusedVariable Variable is never used: $fourteen
src/000_all.php:459 PhanPluginUnusedVariable Variable is never used: $validate
src/000_all.php:468 PhanPluginUnusedVariable Variable is never used: $validate
src/000_all.php:468 PhanTypeMismatchDimFetch When fetching an array index from a value of type array, found an array index of type string[], but expected the index to be of type int|string
src/000_all.php:468 PhanTypeMismatchDimFetch When fetching an array index from a value of type string[], found an array index of type string[], but expected the index to be of type int|string
src/000_all.php:475 PhanPluginUnusedVariable Variable is never used: $a
src/001_func.php:7 PhanPluginUnusedVariable Variable is never used: $one
src/001_func.php:8 PhanPluginUnusedVariable Variable is never used: $two
Expand Down
14 changes: 7 additions & 7 deletions tests/src/000_all.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class testBeing {
public function add(int $my_param):int {
$one = "hello world";
$two = $my_param;
$my_param+1;
echo $my_param+1;
return $my_param;
}

Expand Down Expand Up @@ -336,15 +336,15 @@ public function testForeach()
} while ($b = array_shift($a));
}
}

// This said statement is never used but should be ok
class testAssignmentInWhileCondition
{
public function all(): array
/** @param object $fetcher */
public function all($fetcher): array
{
$collection = [];
$statement = 'select * from users';
while ($row = $statement->fetch()) {

while ($row = $fetcher->fetch()) {
$collection[] = $row;
}

Expand Down Expand Up @@ -461,8 +461,8 @@ function testAssignToArray() {

function testAssignToArrayInLoop()
{
$b = ['c' => 'v'];
$a = ['b' => $b];
$b = ['c' => 'c'];
$a = ['b' => 'c'];
$validate = [];
foreach ($a as $v) {
$validate[$a[$b[$v]]] = 1;
Expand Down

0 comments on commit 9220812

Please sign in to comment.