From 9220812bbd2791290cbebc070d7f1ae06094906a Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Tue, 20 Feb 2018 19:55:11 -0800 Subject: [PATCH] Update the unit tests where phan itself changed analysis --- tests/expected/all_output.expected | 2 -- tests/src/000_all.php | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/expected/all_output.expected b/tests/expected/all_output.expected index 06f4e7b..6d742e5 100644 --- a/tests/expected/all_output.expected +++ b/tests/expected/all_output.expected @@ -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 diff --git a/tests/src/000_all.php b/tests/src/000_all.php index 89ccd82..bd8f9e2 100644 --- a/tests/src/000_all.php +++ b/tests/src/000_all.php @@ -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; } @@ -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; } @@ -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;