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