create(ParserFactory::PREFER_PHP7); $config = \Psalm\Config::getInstance(); $config->throw_exception = true; } public function setUp() { \Psalm\Checker\FileChecker::clearCache(); } public function testNewVarInIf() { $stmts = self::$_parser->parse('foo = []; } if (!is_array($this->foo)) { // do something } } } '); $file_checker = new \Psalm\Checker\FileChecker('somefile.php', $stmts); $file_checker->check(); } }