Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizen-ci committed Mar 19, 2021
1 parent c8f532c commit 02cf396
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getNodeTypes(): array
/**
* @param FuncCall $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): FuncCall
{
foreach ($this->functionArgumentSwaps as $functionArgumentSwap) {
if (! $this->isName($node, $functionArgumentSwap->getFunction())) {
Expand Down
2 changes: 1 addition & 1 deletion rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getNodeTypes(): array
/**
* @param NotEqual $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): NotEqual
{
// invoke override to default "!="
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getNodeTypes(): array
/**
* @param ClassMethod $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): ClassMethod
{
foreach ($this->methodsByType as $type => $methods) {
if (! $this->isObjectType($node, new ObjectType($type))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getNodeTypes(): array
/**
* @param String_ $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): String_
{
$doubleQuoteCount = substr_count($node->value, '"');
$singleQuoteCount = substr_count($node->value, "'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getNodeTypes(): array
/**
* @param Class_ $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Class_
{
foreach ($node->getProperties() as $property) {
$this->refactorProperty($property, $node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getNodeTypes(): array
/**
* @param Class_ $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Class_
{
if ($node instanceof Class_) {
$this->refactorClassAnnotations($node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function getNodeTypes(): array
/**
* @param Property $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Property
{
if ($node instanceof Property) {
$this->refactorPropertyAnnotations($node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getNodeTypes(): array
/**
* @param ClassConst $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): ClassConst
{
$this->visibilityManipulator->removeVisibility($node);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use PhpParser\Node;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Stmt\Return_;
use Rector\Core\Rector\AbstractRector;
use Rector\Php72\NodeFactory\AnonymousFunctionFactory;
Expand Down Expand Up @@ -71,7 +72,7 @@ public function getNodeTypes(): array
/**
* @param ArrowFunction $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Closure
{
$stmts = [new Return_($node->expr)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getNodeTypes(): array
/**
* @param AssignCoalesce $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Assign
{
return new Assign($node->var, new Coalesce($node->var, $node->expr));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getNodeTypes(): array
/**
* @param NullsafeMethodCall|NullsafePropertyFetch $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Ternary
{
$called = $node instanceof NullsafeMethodCall
? new MethodCall($node->var, $node->name, $node->args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getNodeTypes(): array
/**
* @param FuncCall $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): FuncCall
{
if ($this->isName($node, 'mysql_create_db')) {
return $this->processMysqlCreateDb($node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getNodeTypes(): array
/**
* @param Switch_ $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Switch_
{
foreach ($node->cases as $case) {
foreach ($case->stmts as $key => $caseStmt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getNodeTypes(): array
/**
* @param FuncCall $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): FuncCall
{
foreach ($node->args as $nodeArg) {
if ($nodeArg->byRef) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getNodeTypes(): array
/**
* @param Class_ $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): Class_
{
$this->matchedObjectTypes = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getNodeTypes(): array
/**
* @param ClassConstFetch $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): ClassConstFetch
{
foreach ($this->renameClassConstFetches as $renameClassConstFetch) {
if (! $this->isObjectType($node->class, $renameClassConstFetch->getOldObjectType())) {
Expand Down
2 changes: 1 addition & 1 deletion rules/Renaming/Rector/ConstFetch/RenameConstantRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getNodeTypes(): array
/**
* @param ConstFetch $node
*/
public function refactor(Node $node): ?Node
public function refactor(Node $node): ConstFetch
{
foreach ($this->oldToNewConstants as $oldConstant => $newConstant) {
if (! $this->isName($node, $oldConstant)) {
Expand Down

0 comments on commit 02cf396

Please sign in to comment.