This commit is contained in:
TomasVotruba 2017-08-09 17:37:49 +02:00
parent 7c15ea9bfe
commit 2460157303
6 changed files with 25 additions and 6 deletions

View File

@ -33,3 +33,10 @@ checkers:
# new since PhpCsFixer 2.2-2.4
PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer:
use_yoda_style: false
parameters:
skip:
SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff:
- src/Contract/Rector/RectorInterface.php
- *src/Rector/Contrib/Nette/*Rector.php
- *src/NodeVisitor/Traverse/*Visitor.php

View File

@ -43,7 +43,7 @@ final class FileProcessor
}
/**
* @var SplFileInfo[]
* @param SplFileInfo[] $files
*/
public function processFiles(array $files): void
{

View File

@ -41,7 +41,7 @@ final class PropertyRector extends NodeVisitorAbstract
/**
* @param Node[] $nodes
* @return null|array
* @return null|Node[]
*/
public function beforeTraverse(array $nodes): ?array
{
@ -79,7 +79,7 @@ final class PropertyRector extends NodeVisitorAbstract
return true;
}
private function reconstructProperty($propertyNode): Property
private function reconstructProperty(Property $propertyNode): Property
{
$propertyDocBlock = $this->createDocBlockFromNode($propertyNode);
$propertyNode = $this->removeInjectAnnotationFromProperty($propertyNode, $propertyDocBlock);

View File

@ -56,7 +56,7 @@ final class GetterToPropertyRector extends NodeVisitorAbstract
/**
* @param Node[] $nodes
* @return null|array
* @return null|Node[]
*/
public function beforeTraverse(array $nodes): ?array
{
@ -74,7 +74,8 @@ final class GetterToPropertyRector extends NodeVisitorAbstract
public function enterNode(Node $node): ?Node
{
if ($this->isCandidate($node)) {
return $this->reconstruct($node);
$this->reconstruct($node);
return $node;
}
return null;

View File

@ -2,6 +2,7 @@
namespace Rector\Printer;
use PhpParser\Node;
use PhpParser\PrettyPrinter\Standard;
use SplFileInfo;
@ -17,6 +18,11 @@ final class FormatPerservingPrinter
$this->prettyPrinter = $prettyPrinter;
}
/**
* @param Node[] $newStmts
* @param Node[] $oldStmts
* @param Node[] $oldTokens
*/
public function printToFile(SplFileInfo $file, array $newStmts, array $oldStmts, array $oldTokens): void
{
if ($oldStmts === $newStmts) {
@ -27,6 +33,11 @@ final class FormatPerservingPrinter
// @todo: run ecs with minimal set to code look nice
}
/**
* @param Node[] $newStmts
* @param Node[] $oldStmts
* @param Node[] $oldTokens
*/
public function printToString(array $newStmts, array $oldStmts, array $oldTokens): string
{
return $this->prettyPrinter->printFormatPreserving($newStmts, $oldStmts, $oldTokens);

View File

@ -32,7 +32,7 @@ final class RemoveConfiguratorConstantsRector extends AbstractRector
/**
* @param ClassConstFetch $classConstFetchNode
*/
public function refactor($classConstFetchNode): ?Node
public function refactor(ClassConstFetch $classConstFetchNode): ?Node
{
$constantName = (string) $classConstFetchNode->name;
$string = strtolower($constantName);