From 37e8b4adfef636e028fbdab5e1f48010a5274342 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 13 Jan 2017 14:14:24 -0500 Subject: [PATCH] Fix a few issues in tests --- psalm.xml | 18 ------------------ src/Psalm/Type/Union.php | 3 +++ tests/ConfigTest.php | 14 ++++++++++++-- tests/IncludeTest.php | 1 - tests/IssueSuppressionTest.php | 1 - tests/PropertyTypeTest.php | 1 - tests/ScopeTest.php | 3 --- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/psalm.xml b/psalm.xml index d62327136..477eb267a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -18,24 +18,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index b14651304..e45e83863 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -30,6 +30,9 @@ class Union extends Type } } + /** + * @return string + */ public function __toString() { return implode( diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index dc95d0ea6..89c20a7a3 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -8,8 +8,6 @@ use Psalm\Config; class ConfigTest extends PHPUnit_Framework_TestCase { - protected static $file_filter; - /** @var \Psalm\Checker\ProjectChecker */ protected $project_checker; @@ -30,11 +28,19 @@ class ConfigTest extends PHPUnit_Framework_TestCase { return array_filter( array_map( + /** + * @param string $file_name + * @return string + */ function ($file_name) { return substr($file_name, 0, -4); }, scandir(dirname(__DIR__) . '/src/Psalm/Issue') ), + /** + * @param string $issue_name + * @return bool + */ function ($issue_name) { return !empty($issue_name) && $issue_name !== 'CodeError' && $issue_name !== 'CodeIssue'; } @@ -138,6 +144,10 @@ class ConfigTest extends PHPUnit_Framework_TestCase $all_possible_handlers = implode( ' ', array_map( + /** + * @param string $issue_name + * @return string + */ function ($issue_name) { return '<' . $issue_name . ' errorLevel="suppress" />' . PHP_EOL; }, diff --git a/tests/IncludeTest.php b/tests/IncludeTest.php index f2aeacd4e..9cbffa572 100644 --- a/tests/IncludeTest.php +++ b/tests/IncludeTest.php @@ -13,7 +13,6 @@ class IncludeTest extends PHPUnit_Framework_TestCase /** @var \Psalm\Checker\ProjectChecker */ protected $project_checker; - protected static $file_filter; /** * @return void diff --git a/tests/IssueSuppressionTest.php b/tests/IssueSuppressionTest.php index d6ea86213..f1b5fc877 100644 --- a/tests/IssueSuppressionTest.php +++ b/tests/IssueSuppressionTest.php @@ -13,7 +13,6 @@ class IssueSuppressionTest extends PHPUnit_Framework_TestCase /** @var \Psalm\Checker\ProjectChecker */ protected $project_checker; - protected static $file_filter; /** * @return void diff --git a/tests/PropertyTypeTest.php b/tests/PropertyTypeTest.php index 964ea17bf..fb2748f62 100644 --- a/tests/PropertyTypeTest.php +++ b/tests/PropertyTypeTest.php @@ -14,7 +14,6 @@ class PropertyTypeTest extends PHPUnit_Framework_TestCase /** @var \Psalm\Checker\ProjectChecker */ protected $project_checker; - protected static $file_filter; /** * @return void diff --git a/tests/ScopeTest.php b/tests/ScopeTest.php index 99208c59d..7688cbf5d 100644 --- a/tests/ScopeTest.php +++ b/tests/ScopeTest.php @@ -14,7 +14,6 @@ class ScopeTest extends PHPUnit_Framework_TestCase /** @var \Psalm\Checker\ProjectChecker */ protected $project_checker; - protected static $file_filter; /** * @return void @@ -523,8 +522,6 @@ class ScopeTest extends PHPUnit_Framework_TestCase echo $a; '); - Config::getInstance()->setIssueHandler('PossiblyUndefinedVariable', self::$file_filter); - $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); }