Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused class #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions src/Scrutinizer/PhpAnalyzer/Pass/LoopsMustUseBracesPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,46 @@

namespace Scrutinizer\PhpAnalyzer\Pass;

use JMS\PhpManipulator\TokenStream;
use Scrutinizer\PhpAnalyzer\Analyzer;
use Scrutinizer\PhpAnalyzer\AnalyzerAwareInterface;
use Scrutinizer\PhpAnalyzer\Config\NodeBuilder;
use JMS\PhpManipulator\TokenStream\PhpToken;
use Scrutinizer\PhpAnalyzer\Model\Comment;
use Scrutinizer\PhpAnalyzer\Model\File;
use Scrutinizer\PhpAnalyzer\Model\PhpFile;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

// TODO: This should either be removed completely, or moved to a general style check pass.
class LoopsMustUseBracesPass extends TokenStreamAnalyzerPass implements ConfigurablePassInterface
class LoopsMustUseBracesPass implements ConfigurablePassInterface, AnalyzerAwareInterface
{
use ConfigurableTrait;

protected $analyzer;
protected $phpFile;
protected $stream;

public function __construct()
{
$this->stream = new TokenStream();
}

public function setAnalyzer(Analyzer $analyzer)
{
$this->analyzer = $analyzer;
}

public function analyze(File $file)
{
if (!$file instanceof PhpFile || !$this->getSetting('enabled')) {
return;
}

$this->phpFile = $file;
$this->stream->setCode($file->getContent());
$this->analyzeStream();
}

public function getConfiguration()
{
$tb = new TreeBuilder();
Expand All @@ -41,10 +71,6 @@ public function getConfiguration()

protected function analyzeStream()
{
if ( ! $this->getSetting('enabled')) {
return;
}

while ($this->stream->moveNext()) {
if ( ! $this->stream->token instanceof PhpToken) {
continue;
Expand Down
56 changes: 0 additions & 56 deletions src/Scrutinizer/PhpAnalyzer/Pass/TokenStreamAnalyzerPass.php

This file was deleted.