create(ParserFactory::PREFER_PHP7); $config = \Psalm\Config::getInstance(); $config->throw_exception = true; $config->use_docblock_types = true; } public function setUp() { \Psalm\Checker\FileChecker::clearCache(); } public function testConstArray() { $stmts = self::$_parser->parse('check(true, true, $context); $this->assertEquals('string', (string) $context->vars_in_scope['$a']); } public function testConstFeatures() { $stmts = self::$_parser->parse('f(); $e = C::SENTENCE; $f = TWO; $g = C::ONE_THIRD; '); $file_checker = new \Psalm\Checker\FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); $this->assertEquals('int', (string) $context->vars_in_scope['$d']); $this->assertEquals('string', (string) $context->vars_in_scope['$e']); $this->assertEquals('int', (string) $context->vars_in_scope['$f']); $this->assertEquals('float', (string) $context->vars_in_scope['$g']); } public function testVariadic() { $stmts = self::$_parser->parse('check(true, true, $context); } public function testVariadicArray() { $stmts = self::$_parser->parse('check(true, true, $context); } public function testArgumentUnpacking() { $stmts = self::$_parser->parse('check(true, true, $context); } public function testExponentiation() { $stmts = self::$_parser->parse('check(true, true, $context); } public function testUse() { $this->markTestIncomplete('This passes, but I think thereā€˜s cheating afoot'); $stmts = self::$_parser->parse('check(true, true, $context); } }