public List<PhpIssue> analyze() { ImmutableList.Builder<PhpIssue> issuesBuilder = ImmutableList.builder(); for (PHPCheck check : checks) { PHPCheckContext context = new PHPCheckContext(currentFile, currentFileTree, workingDir, currentFileSymbolTable); issuesBuilder.addAll(check.analyze(context)); } return issuesBuilder.build(); }
public List<PhpIssue> analyze() { ImmutableList.Builder<PhpIssue> issuesBuilder = ImmutableList.builder(); for (PHPCheck check : checks) { PHPCheckContext context = new PHPCheckContext(currentFile, currentFileTree, workingDir, currentFileSymbolTable); issuesBuilder.addAll(check.analyze(context)); } return issuesBuilder.build(); }
@Override public List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree, SymbolTable symbolTable) { return analyze(new PHPCheckContext(file, tree, null, symbolTable)); }
@Override public final List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree) { return analyze(new PHPCheckContext(file, tree, null)); }
@Override public final List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree) { return analyze(new PHPCheckContext(file, tree, null)); }
@Override public final List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree) { return analyze(new PHPCheckContext(file, tree, null)); }
@Override public final List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree) { return analyze(new PHPCheckContext(file, tree, null)); }
@Override public List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree, SymbolTable symbolTable) { return analyze(new PHPCheckContext(file, tree, null, symbolTable)); }
@Override public List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree, SymbolTable symbolTable) { return analyze(new PHPCheckContext(file, tree, null, symbolTable)); }
@Override public List<PhpIssue> analyze(PhpFile file, CompilationUnitTree tree, SymbolTable symbolTable) { return analyze(new PHPCheckContext(file, tree, null, symbolTable)); }
@Before public void setUp() throws Exception { PhpFile file = mock(PhpFile.class); when(file.toString()).thenReturn("mock.php"); checkContext = new PHPCheckContext(file, mock(CompilationUnitTreeImpl.class), null, mock(SymbolTable.class)); }
@Test public void should_have_correct_context() { ActionParser<Tree> parser = PHPParserBuilder.createParser(); PhpFile file = FileTestUtils.getFile(new File("src/test/resources/visitors/test.php")); CompilationUnitTree tree = (CompilationUnitTree) parser.parse(file.contents()); ContextTestVisitor testVisitor = new ContextTestVisitor(); testVisitor.analyze(file, tree); assertThat(testVisitor.context().getPhpFile()).isEqualTo(file); assertThat(testVisitor.context().getWorkingDirectory()).isNull(); File workingDir = new File("working_dir"); testVisitor.analyze(new PHPCheckContext(file, tree, workingDir)); assertThat(testVisitor.context().getWorkingDirectory()).isEqualTo(workingDir); }