create(ParserFactory::PREFER_PHP7); } public function setUp() { $config = new TestConfig(); $config->throw_exception = true; $config->use_docblock_types = true; FileChecker::clearCache(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidStaticInvocation */ public function testInvalidStaticInvocation() { $stmts = self::$parser->parse('check(true, true, $context); } public function testValidNonStaticInvocation() { $stmts = self::$parser->parse('bar(); '); $file_checker = new FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage MixedMethodCall */ public function testMixedMethodCall() { $filter = new Config\FileFilter(false); $filter->addExcludeFile('somefile.php'); Config::getInstance()->setIssueHandler('MissingPropertyType', $filter); Config::getInstance()->setIssueHandler('MixedAssignment', $filter); $stmts = self::$parser->parse('bar(); '); $file_checker = new FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); } public function testValidStaticInvocation() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage ParentNotFound */ public function testNoParent() { $stmts = self::$parser->parse('check(true, true, $context); } }