create(ParserFactory::PREFER_PHP7); self::$config = new TestConfig(); } /** * @return void */ public function setUp() { FileChecker::clearCache(); $this->project_checker = new \Psalm\Checker\ProjectChecker(); $this->project_checker->setConfig(self::$config); } /** * @return void */ public function testTwoVarLogic() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testThreeVarLogic() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage NullArgument * @return void */ public function testThreeVarLogicWithChange() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage NullArgument * @return void */ public function testThreeVarLogicWithException() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNested() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNestedWithAllPathsReturning() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNestedWithAssignmentBeforeReturn() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testInvertedTwoVarLogicNotNested() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testInvertedTwoVarLogicNotNestedWithAssignmentBeforeReturn() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType * @return void */ public function testInvertedTwoVarLogicNotNestedWithVarChange() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType * @return void */ public function testInvertedTwoVarLogicNotNestedWithElseif() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNestedWithElseif() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testThreeVarLogicNotNested() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testThreeVarLogicNotNestedAndOr() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType * @return void */ public function testThreeVarLogicWithElseifAndAnd() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType * @return void */ public function testTwoVarLogicNotNestedWithElseifNegatedInIf() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNestedWithElseifCorrectlyNegatedInElseIf() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidReturnType * @return void */ public function testTwoVarLogicNotNestedWithElseifIncorrectlyReinforcedInIf() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testTwoVarLogicNotNestedWithElseifCorrectlyReinforcedInIf() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage ParadoxicalCondition * @return void */ public function testRepeatedIfStatements() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage ParadoxicalCondition * @return void */ public function testRepeatedConditionals() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * This shouldn't throw an error * * @return void */ public function testDifferentValueChecks() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * This shouldn't throw an error * * @return void */ public function testRepeatedSet() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testRepeatedSetInsideWhile() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } /** * @return void */ public function testByRefAssignment() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndAnalyzeMethods(); } }