mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-15 15:42:22 +00:00
cs updates
This commit is contained in:
parent
8c5bd3ae93
commit
3ee53abfda
|
@ -15,16 +15,16 @@ require_once __DIR__ . '/rector_bootstrap.php';
|
|||
|
||||
try {
|
||||
// 1. Detect configuration from --level
|
||||
$configFile = (new RectorConfigFilePathHelper)->resolveLevel(new ArgvInput);
|
||||
$configFile = (new RectorConfigFilePathHelper())->resolveLevel(new ArgvInput());
|
||||
|
||||
// 2. Or from --config
|
||||
if ($configFile === null) {
|
||||
ConfigFilePathHelper::detectFromInput('rector', new ArgvInput);
|
||||
ConfigFilePathHelper::detectFromInput('rector', new ArgvInput());
|
||||
$configFile = ConfigFilePathHelper::provide('rector', 'rector.yml');
|
||||
}
|
||||
|
||||
// 2. Build DI container
|
||||
$containerFactory = new ContainerFactory;
|
||||
$containerFactory = new ContainerFactory();
|
||||
if ($configFile) {
|
||||
$container = $containerFactory->createWithConfig($configFile);
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"phpstan/phpstan-shim": "^0.8",
|
||||
"phpunit/phpunit": "^6.4",
|
||||
"symplify/coding-standard": "^3.0",
|
||||
"symplify/token-runner": "^3.0",
|
||||
"symplify/token-runner": "dev-master#0af8cc8",
|
||||
"slam/php-cs-fixer-extensions": "^1.8",
|
||||
"symfony/expression-language": "^3.4|^4.0",
|
||||
"symfony/form": "^3.4|^4.0",
|
||||
|
|
|
@ -31,14 +31,8 @@ checkers:
|
|||
|
||||
parameters:
|
||||
exclude_checkers:
|
||||
# excluded from symfony-checkers.neon
|
||||
- PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer
|
||||
- PhpCsFixer\Fixer\Operator\NewWithBracesFixer
|
||||
- PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer
|
||||
- PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer
|
||||
- PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer
|
||||
- PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer
|
||||
- PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer
|
||||
# too strict - remove
|
||||
- Symplify\CodingStandard\Fixer\Solid\NoInterfaceOnAbstractClassFixer
|
||||
|
||||
skip:
|
||||
Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer:
|
||||
|
|
|
@ -29,7 +29,7 @@ final class RectorGuesserTest extends AbstractContainerAwareTestCase
|
|||
public function test(string $message, string $expectedType): void
|
||||
{
|
||||
$deprecations = [
|
||||
Deprecation::createFromMessageAndNode($message, new Nop),
|
||||
Deprecation::createFromMessageAndNode($message, new Nop()),
|
||||
];
|
||||
|
||||
$rectorGuesses = $this->rectorGuesser->guessForDeprecations($deprecations);
|
||||
|
|
|
@ -24,7 +24,7 @@ final class UnsupportedDeprecationFilterTest extends AbstractContainerAwareTestC
|
|||
*/
|
||||
public function test(string $message, bool $isMatched): void
|
||||
{
|
||||
$deprecation = Deprecation::createFromMessageAndNode($message, new Nop);
|
||||
$deprecation = Deprecation::createFromMessageAndNode($message, new Nop());
|
||||
|
||||
$this->assertSame($isMatched, $this->unsupportedDeprecationFilter->matches($deprecation));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ final class RectorGuessFactoryTest extends TestCase
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->rectorGuessFactory = new RectorGuessFactory;
|
||||
$this->rectorGuessFactory = new RectorGuessFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ final class RectorGuessFactoryTest extends TestCase
|
|||
public function test(string $method, string $expectedType, bool $isUseful): void
|
||||
{
|
||||
/** @var RectorGuess $rectorGuess */
|
||||
$rectorGuess = $this->rectorGuessFactory->$method('message', new Nop);
|
||||
$rectorGuess = $this->rectorGuessFactory->$method('message', new Nop());
|
||||
|
||||
$this->assertSame('message', $rectorGuess->getMessage());
|
||||
$this->assertInstanceOf(Nop::class, $rectorGuess->getNode());
|
||||
|
|
|
@ -29,8 +29,8 @@ final class RectorGuessFilterTest extends AbstractContainerAwareTestCase
|
|||
{
|
||||
$rectorGuesses = [];
|
||||
|
||||
$rectorGuesses[] = $this->rectorGuessFactory->createClassReplacer('message', new Nop);
|
||||
$rectorGuesses[] = $this->rectorGuessFactory->createUnsupported('message', new Nop);
|
||||
$rectorGuesses[] = $this->rectorGuessFactory->createClassReplacer('message', new Nop());
|
||||
$rectorGuesses[] = $this->rectorGuessFactory->createUnsupported('message', new Nop());
|
||||
|
||||
$this->assertCount(2, $rectorGuesses);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ final class NestedMethodCallTest extends AbstractNodeTypeResolverTest
|
|||
$this->assertSame('addText', $methodCallNodes[2]->name->toString());
|
||||
$this->assertContains(
|
||||
'Nette\Application\UI\Form',
|
||||
|
||||
$methodCallNodes[2]->getAttribute(Attribute::CALLER_TYPES)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class DocBlockFactory
|
|||
TypeResolver $typeResolver,
|
||||
NamespaceNodeToReflectionTypeContext $namespaceNodeToReflectionTypeContext
|
||||
) {
|
||||
$this->docBlocksPerNode = new SplObjectStorage;
|
||||
$this->docBlocksPerNode = new SplObjectStorage();
|
||||
$this->phpDocumentorDocBlockFactory = $phpDocumentorDocBlockFactory;
|
||||
$this->namespaceNodeToReflectionTypeContext = $namespaceNodeToReflectionTypeContext;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ final class StatementGlue
|
|||
public function insertBeforeAndFollowWithNewline(array $nodes, Node $node, int $key): array
|
||||
{
|
||||
$nodes = $this->insertBefore($nodes, $node, $key);
|
||||
$nodes = $this->insertBefore($nodes, new Nop, $key);
|
||||
$nodes = $this->insertBefore($nodes, new Nop(), $key);
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
|
|
@ -51,14 +51,14 @@ final class AppKernel extends Kernel
|
|||
public function registerBundles(): array
|
||||
{
|
||||
return [
|
||||
new RectorBundle,
|
||||
new RectorBundle(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function build(ContainerBuilder $containerBuilder): void
|
||||
{
|
||||
$containerBuilder->addCompilerPass(new CollectorCompilerPass);
|
||||
$containerBuilder->addCompilerPass(new NodeValueResolverCollectorCompilerPass);
|
||||
$containerBuilder->addCompilerPass(new NodeTypeResolverCollectorCompilerPass);
|
||||
$containerBuilder->addCompilerPass(new CollectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new NodeValueResolverCollectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new NodeTypeResolverCollectorCompilerPass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ final class ContainerFactory
|
|||
{
|
||||
public function create(): ContainerInterface
|
||||
{
|
||||
$appKernel = new AppKernel;
|
||||
$appKernel = new AppKernel();
|
||||
$appKernel->boot();
|
||||
|
||||
return $appKernel->getContainer();
|
||||
|
|
|
@ -12,8 +12,8 @@ final class RectorBundle extends Bundle
|
|||
public function getContainerExtension(): RectorsExtension
|
||||
{
|
||||
return new RectorsExtension(
|
||||
new RectorClassValidator,
|
||||
new RectorClassNormalizer
|
||||
new RectorClassValidator(),
|
||||
new RectorClassNormalizer()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ final class NodeTraverserFactory
|
|||
{
|
||||
public function createWithNodeVisitor(NodeVisitor $nodeVisitor): NodeTraverser
|
||||
{
|
||||
$nodeTraverser = new NodeTraverser;
|
||||
$nodeTraverser = new NodeTraverser();
|
||||
$nodeTraverser->addVisitor($nodeVisitor);
|
||||
|
||||
return $nodeTraverser;
|
||||
|
|
|
@ -41,6 +41,6 @@ final class NodeRemover extends NodeVisitorAbstract
|
|||
$parentNode->setAttribute(Attribute::ORIGINAL_NODE, null);
|
||||
}
|
||||
|
||||
return new Nop;
|
||||
return new Nop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ abstract class AbstractRector extends NodeVisitorAbstract implements RectorInter
|
|||
*/
|
||||
final public function beforeTraverse(array $nodes): array
|
||||
{
|
||||
$this->expressionsToPrependBefore = new SplObjectStorage;
|
||||
$this->expressionsToPrependAfter = new SplObjectStorage;
|
||||
$this->expressionsToPrependBefore = new SplObjectStorage();
|
||||
$this->expressionsToPrependAfter = new SplObjectStorage();
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ abstract class AbstractConfigurableRectorTestCase extends AbstractRectorTestCase
|
|||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->container = (new ContainerFactory)->createWithConfig($this->provideConfig());
|
||||
$this->container = (new ContainerFactory())->createWithConfig($this->provideConfig());
|
||||
|
||||
$this->fileProcessor = $this->container->get(FileProcessor::class);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ abstract class AbstractRectorTestCase extends TestCase
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->container = (new ContainerFactory)->createWithConfig(__DIR__ . '/../../config/levels.yml');
|
||||
$this->container = (new ContainerFactory())->createWithConfig(__DIR__ . '/../../config/levels.yml');
|
||||
|
||||
$this->fileProcessor = $this->container->get(FileProcessor::class);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ abstract class AbstractContainerAwareTestCase extends TestCase
|
|||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
|
||||
$this->container = (new ContainerFactory)->create();
|
||||
$this->container = (new ContainerFactory())->create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ final class RectorClassNormalizerTest extends TestCase
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->rectorClassNormalizer = new RectorClassNormalizer;
|
||||
$this->rectorClassNormalizer = new RectorClassNormalizer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ final class RectorClassValidatorTest extends TestCase
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->rectorClassValidator = new RectorClassValidator;
|
||||
$this->rectorClassValidator = new RectorClassValidator();
|
||||
}
|
||||
|
||||
public function testNonExistingClass(): void
|
||||
|
|
|
@ -8,7 +8,7 @@ final class SomeClass
|
|||
{
|
||||
public function createHtml(): void
|
||||
{
|
||||
$html = new Html;
|
||||
$html = new Html();
|
||||
$anotherHtml = $html;
|
||||
$anotherHtml->addHtml('someContent');
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ final class SomeClass
|
|||
{
|
||||
public function createHtml(): void
|
||||
{
|
||||
$html = new Html;
|
||||
$html = new Html();
|
||||
$anotherHtml = $html;
|
||||
$anotherHtml->add('someContent');
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ final class RectorCollectorTest extends AbstractContainerAwareTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
$this->rectorCollector = $this->container->get(RectorCollector::class);
|
||||
$this->rectorCollector->addRector(new DummyRector);
|
||||
$this->rectorCollector->addRector(new DummyRector());
|
||||
|
||||
$dummyRector = $this->rectorCollector->getRector(DummyRector::class);
|
||||
$this->assertInstanceOf(DummyRector::class, $dummyRector);
|
||||
|
|
Loading…
Reference in New Issue
Block a user