Skip to content

Commit

Permalink
Updated Rector to commit 4a77565302216f6fde71232600cd175422a00965
Browse files Browse the repository at this point in the history
rectorphp/rector-src@4a77565 ExplicitReturnNullRector should skip never return (#5802)
  • Loading branch information
TomasVotruba committed Apr 5, 2024
1 parent 6e04d0e commit 6678ca0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
use Rector\Rector\AbstractRector;
use Rector\TypeDeclaration\NodeAnalyzer\NeverFuncCallAnalyzer;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
use Rector\TypeDeclaration\TypeInferer\SilentVoidResolver;
use Rector\ValueObject\MethodName;
Expand Down Expand Up @@ -50,17 +51,23 @@ final class ExplicitReturnNullRector extends AbstractRector
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger
*/
private $phpDocTypeChanger;
/**
* @readonly
* @var \Rector\TypeDeclaration\NodeAnalyzer\NeverFuncCallAnalyzer
*/
private $neverFuncCallAnalyzer;
/**
* @readonly
* @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer
*/
private $returnTypeInferer;
public function __construct(SilentVoidResolver $silentVoidResolver, PhpDocInfoFactory $phpDocInfoFactory, TypeFactory $typeFactory, PhpDocTypeChanger $phpDocTypeChanger, ReturnTypeInferer $returnTypeInferer)
public function __construct(SilentVoidResolver $silentVoidResolver, PhpDocInfoFactory $phpDocInfoFactory, TypeFactory $typeFactory, PhpDocTypeChanger $phpDocTypeChanger, NeverFuncCallAnalyzer $neverFuncCallAnalyzer, ReturnTypeInferer $returnTypeInferer)
{
$this->silentVoidResolver = $silentVoidResolver;
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->typeFactory = $typeFactory;
$this->phpDocTypeChanger = $phpDocTypeChanger;
$this->neverFuncCallAnalyzer = $neverFuncCallAnalyzer;
$this->returnTypeInferer = $returnTypeInferer;
}
public function getRuleDefinition() : RuleDefinition
Expand Down Expand Up @@ -132,7 +139,7 @@ public function refactor(Node $node) : ?Node
}
return null;
});
if (!$this->silentVoidResolver->hasSilentVoid($node)) {
if (!$this->silentVoidResolver->hasSilentVoid($node) || $this->neverFuncCallAnalyzer->hasNeverFuncCall($node)) {
if ($hasChanged) {
$this->transformDocUnionVoidToUnionNull($node);
return $node;
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '1.0.4';
public const PACKAGE_VERSION = '4a77565302216f6fde71232600cd175422a00965';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-04-04 20:57:17';
public const RELEASE_DATE = '2024-04-05 20:02:11';
/**
* @var int
*/
Expand Down

0 comments on commit 6678ca0

Please sign in to comment.