From 24601573036edf419b135862411ea344c814fe21 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Wed, 9 Aug 2017 17:37:49 +0200 Subject: [PATCH] fix cs --- easy-coding-standard.neon | 7 +++++++ src/Application/FileProcessor.php | 2 +- .../InjectAnnotationToConstructor/PropertyRector.php | 4 ++-- .../GetterToPropertyRector.php | 5 +++-- src/Printer/FormatPerservingPrinter.php | 11 +++++++++++ .../Nette/RemoveConfiguratorConstantsRector.php | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index bc35cb3f481..eb3ea104c99 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -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 diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index 71a8d8a3899..e14aeec8a4e 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -43,7 +43,7 @@ final class FileProcessor } /** - * @var SplFileInfo[] + * @param SplFileInfo[] $files */ public function processFiles(array $files): void { diff --git a/src/NodeVisitor/DependencyInjection/InjectAnnotationToConstructor/PropertyRector.php b/src/NodeVisitor/DependencyInjection/InjectAnnotationToConstructor/PropertyRector.php index 0d4e9bde0cd..e47e1cd4c33 100644 --- a/src/NodeVisitor/DependencyInjection/InjectAnnotationToConstructor/PropertyRector.php +++ b/src/NodeVisitor/DependencyInjection/InjectAnnotationToConstructor/PropertyRector.php @@ -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); diff --git a/src/NodeVisitor/DependencyInjection/NamedServicesToConstructor/GetterToPropertyRector.php b/src/NodeVisitor/DependencyInjection/NamedServicesToConstructor/GetterToPropertyRector.php index 2ede1dc2689..665db5b56a8 100644 --- a/src/NodeVisitor/DependencyInjection/NamedServicesToConstructor/GetterToPropertyRector.php +++ b/src/NodeVisitor/DependencyInjection/NamedServicesToConstructor/GetterToPropertyRector.php @@ -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; diff --git a/src/Printer/FormatPerservingPrinter.php b/src/Printer/FormatPerservingPrinter.php index ca6a78676e3..ee8a7c7b81e 100644 --- a/src/Printer/FormatPerservingPrinter.php +++ b/src/Printer/FormatPerservingPrinter.php @@ -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); diff --git a/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php b/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php index 801bd4e38f9..ea36cc6144a 100644 --- a/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php +++ b/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php @@ -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);