Skip to content

Commit

Permalink
[Strict] Skip @return docblock on BooleanInIfConditionRuleFixerRector (
Browse files Browse the repository at this point in the history
…#4609)

* [Strict] Skip @return docblock on BooleanInIfConditionRuleFixerRector

* fix
  • Loading branch information
samsonasik committed Jul 26, 2023
1 parent 65e6cae commit b5f973f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector\Fixture;

final class SkipFromReturnDocblock
{
/**
* @return array
*/
private function getItems()
{
}

public function run()
{
if ($this->getItems()) {
return true;
}

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function refactorWithScope(Node $node, Scope $scope): ?If_
$hasChanged = false;

// 1. if
$ifCondExprType = $scope->getType($node->cond);
$ifCondExprType = $scope->getNativeType($node->cond);
$notIdentical = $this->exactCompareFactory->createNotIdenticalFalsyCompare(
$ifCondExprType,
$node->cond,
Expand All @@ -100,7 +100,7 @@ public function refactorWithScope(Node $node, Scope $scope): ?If_

// 2. elseifs
foreach ($node->elseifs as $elseif) {
$elseifCondExprType = $scope->getType($elseif->cond);
$elseifCondExprType = $scope->getNativeType($elseif->cond);
$notIdentical = $this->exactCompareFactory->createNotIdenticalFalsyCompare(
$elseifCondExprType,
$elseif->cond,
Expand Down

0 comments on commit b5f973f

Please sign in to comment.