create(ParserFactory::PREFER_PHP7); $config = new TestConfig(); } public function setUp() { FileChecker::clearCache(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage UndefinedClass */ public function testUndefinedClass() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidClass */ public function testWrongCaseClass() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidScope */ public function testInvalidThisFetch() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidScope */ public function testInvalidThisAssignment() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage UndefinedConstant */ public function testUndefinedConstant() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage UndefinedConstant */ public function testUndefinedClassConstant() { $stmts = self::$parser->parse('check(true, true, $context); } public function testSingleFileInheritance() { $stmts = self::$parser->parse('bar(); } protected function bar() : void { echo "hello"; } }'); $file_checker = new FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); } }