create(ParserFactory::PREFER_PHP7); } public function setUp() { $config = new TestConfig(); FileChecker::clearCache(); $this->project_checker = new \Psalm\Checker\ProjectChecker(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidArgument */ public function testEchoClass() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidToString */ public function testInvalidToStringReturnType() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidToString */ public function testInvalidInferredToStringReturnType() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } public function testValidToString() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } public function testValidInferredToStringType() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage ImplicitToStringCast */ public function testImplicitCast() { $stmts = self::$parser->parse('project_checker, $stmts); $context = new Context('somefile.php'); $file_checker->visitAndAnalyzeMethods($context); } }