create(ParserFactory::PREFER_PHP7); $config = new TestConfig(); } public function setUp() { FileChecker::clearCache(); } public function testByRefUseVar() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidScalarArgument */ public function testWrongArg() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType */ public function testNoReturn() { $stmts = self::$parser->parse('check(true, true, $context); } public function testInferredArg() { $stmts = self::$parser->parse('check(true, true, $context); } public function testVarReturnType() { $stmts = self::$parser->parse('check(true, true, $context); $this->assertEquals('int', (string) $context->vars_in_scope['$a']); } public function testCallable() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidFunctionCall */ public function testStringFunctionCall() { $stmts = self::$parser->parse('check(true, true, $context); $this->assertEquals('int', (string) $context->vars_in_scope['$a']); } }