mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
cs fixes
This commit is contained in:
parent
0d8fb213c0
commit
ea88254312
@ -9,6 +9,7 @@ $possibleAutoloadPaths = [__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../..
|
||||
foreach ($possibleAutoloadPaths as $possibleAutoloadPath) {
|
||||
if (is_file($possibleAutoloadPath)) {
|
||||
require_once $possibleAutoloadPath;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Scalar\MagicConst\Method;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\DeprecationExtractor\Contract\Deprecation\DeprecationInterface;
|
||||
use Rector\Exception\NotImplementedException;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\DeprecationExtractor\Contract\Deprecation\DeprecationInterface;
|
||||
|
||||
final class DeprecationFactory
|
||||
{
|
||||
@ -26,9 +26,6 @@ final class DeprecationFactory
|
||||
*/
|
||||
public function createFromNode(Node $node, string $scope): DeprecationInterface
|
||||
{
|
||||
dump($node->getAttribute(Attribute::SCOPE));
|
||||
die;
|
||||
|
||||
$message = '';
|
||||
if ($node instanceof Concat) {
|
||||
$message .= $this->processConcatNode($node->left);
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace Rector\DeprecationExtractor;
|
||||
|
||||
use Rector\Contract\Parser\ParserInterface;
|
||||
use Rector\DeprecationExtractor\NodeVisitor\DeprecationDetector;
|
||||
use Rector\NodeTraverser\MainNodeTraverser;
|
||||
use Rector\NodeTraverser\StandaloneTraverseNodeTraverser;
|
||||
use Rector\DeprecationExtractor\NodeVisitor\DeprecationDetector;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
|
@ -4,11 +4,10 @@ namespace Rector\DeprecationExtractor\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use PhpParser\PrettyPrinter\Standard;
|
||||
use Rector\DeprecationExtractor\Deprecation\DeprecationCollector;
|
||||
use Rector\DeprecationExtractor\NodeAnalyzer\TriggerErrorAnalyzer;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\NodeAnalyzer\DocBlockAnalyzer;
|
||||
use Rector\DeprecationExtractor\Deprecation\DeprecationCollector;
|
||||
|
||||
/**
|
||||
* Inspired by https://github.com/sensiolabs-de/deprecation-detector/blob/master/src/Visitor/Deprecation/FindDeprecatedTagsVisitor.php
|
||||
@ -25,10 +24,6 @@ final class DeprecationDetector extends NodeVisitorAbstract
|
||||
*/
|
||||
private $docBlockAnalyzer;
|
||||
|
||||
/**
|
||||
* @var Standard
|
||||
*/
|
||||
private $prettyPrinter;
|
||||
/**
|
||||
* @var TriggerErrorAnalyzer
|
||||
*/
|
||||
@ -37,12 +32,10 @@ final class DeprecationDetector extends NodeVisitorAbstract
|
||||
public function __construct(
|
||||
DeprecationCollector $deprecationCollector,
|
||||
DocBlockAnalyzer $docBlockAnalyzer,
|
||||
Standard $prettyPrinter,
|
||||
TriggerErrorAnalyzer $triggerErrorAnalyzer
|
||||
) {
|
||||
$this->deprecationCollector = $deprecationCollector;
|
||||
$this->docBlockAnalyzer = $docBlockAnalyzer;
|
||||
$this->prettyPrinter = $prettyPrinter;
|
||||
$this->triggerErrorAnalyzer = $triggerErrorAnalyzer;
|
||||
}
|
||||
|
||||
@ -50,13 +43,13 @@ final class DeprecationDetector extends NodeVisitorAbstract
|
||||
{
|
||||
if ($this->docBlockAnalyzer->hasAnnotation($node, 'deprecated')) {
|
||||
$this->processDocBlockDeprecation($node);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// @todo detect the elments it's realted to
|
||||
if ($this->triggerErrorAnalyzer->isUserDeprecation($node)) {
|
||||
dump($node->getAttribute(Attribute::SCOPE));
|
||||
// dump($node);
|
||||
die;
|
||||
|
||||
$scope = $node->getAttribute(Attribute::SCOPE);
|
||||
|
@ -3,10 +3,10 @@
|
||||
namespace Rector\DeprecationExtractor\Rector;
|
||||
|
||||
use Rector\Contract\Rector\RectorInterface;
|
||||
use Rector\Exception\NotImplementedException;
|
||||
use Rector\DeprecationExtractor\Contract\Deprecation\DeprecationInterface;
|
||||
use Rector\DeprecationExtractor\Deprecation\ClassMethodDeprecation;
|
||||
use Rector\DeprecationExtractor\Deprecation\DeprecationCollector;
|
||||
use Rector\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* Creates rectors with propper setup based on found deprecations.
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Rector\DeprecationExtractor\Tests;
|
||||
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use Rector\DeprecationExtractor\Deprecation\DeprecationCollector;
|
||||
use Rector\DeprecationExtractor\DeprecationExtractor;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
|
||||
final class DeprecationExtractorTest extends AbstractContainerAwareTestCase
|
||||
{
|
||||
|
@ -3,10 +3,10 @@
|
||||
namespace Rector\DeprecationExtractor\Tests\Rector;
|
||||
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use Rector\DeprecationExtractor\DeprecationExtractor;
|
||||
use Rector\DeprecationExtractor\Rector\ConfigurableChangeMethodNameRector;
|
||||
use Rector\DeprecationExtractor\Rector\RectorFactory;
|
||||
use Rector\DeprecationExtractor\DeprecationExtractor;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
|
||||
final class RectorFactoryTest extends AbstractContainerAwareTestCase
|
||||
{
|
||||
|
@ -70,10 +70,12 @@ final class ScopeResolver extends NodeVisitorAbstract
|
||||
}
|
||||
|
||||
$this->currentScope = null;
|
||||
$this->currentScopeNode = null;
|
||||
}
|
||||
|
||||
if ($node instanceof ClassMethod || $node instanceof Function_) {
|
||||
$this->currentScope = null;
|
||||
$this->currentScopeNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ final class Attribute
|
||||
* @var string
|
||||
*/
|
||||
public const PREVIOUS_NODE = 'prev_node';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -45,6 +45,7 @@ final class DocBlockAnalyzer
|
||||
|
||||
if ($type === 'deprecated') {
|
||||
$content = $annotationTags[0]->getContent();
|
||||
|
||||
return ltrim($content, '* @deprecated ');
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ final class PropertyToClassAdder extends NodeVisitorAbstract
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node instanceof Class_ && ! $node->isAnonymous()) {
|
||||
$nodes[$key] = $this->processClass($node, (string) $node->name);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user