mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit e400e37e5fe1d329419874143c16d53242cf5b55
e400e37e5f
[DeadCode] Remove null as never used param type in RemoveUselessParamTagRector (#5348)
This commit is contained in:
parent
5c2f93e7b7
commit
bb15f9c3c4
|
@ -62,6 +62,10 @@ final class DeadParamTagValueNodeAnalyzer
|
|||
if (!$param instanceof Param) {
|
||||
return \false;
|
||||
}
|
||||
// param null is always dead
|
||||
if ($this->isNullTagValueNode($paramTagValueNode)) {
|
||||
return \true;
|
||||
}
|
||||
if ($param->type === null) {
|
||||
return \false;
|
||||
}
|
||||
|
@ -85,4 +89,11 @@ final class DeadParamTagValueNodeAnalyzer
|
|||
}
|
||||
return !$this->genericTypeNodeAnalyzer->hasGenericType($paramTagValueNode->type);
|
||||
}
|
||||
private function isNullTagValueNode(ParamTagValueNode $paramTagValueNode) : bool
|
||||
{
|
||||
if (!$paramTagValueNode->type instanceof IdentifierTypeNode) {
|
||||
return \false;
|
||||
}
|
||||
return (string) $paramTagValueNode->type === 'null';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,10 @@ final class DeadReturnTagValueNodeAnalyzer
|
|||
public function isDead(ReturnTagValueNode $returnTagValueNode, $functionLike) : bool
|
||||
{
|
||||
$returnType = $functionLike->getReturnType();
|
||||
if ($this->isNullTagValueNode($returnTagValueNode)) {
|
||||
// return null is always unused
|
||||
return \true;
|
||||
}
|
||||
if ($returnType === null) {
|
||||
return \false;
|
||||
}
|
||||
|
@ -149,4 +153,11 @@ final class DeadReturnTagValueNodeAnalyzer
|
|||
}
|
||||
return !$this->isNeverReturnType($returnType);
|
||||
}
|
||||
private function isNullTagValueNode(ReturnTagValueNode $returnTagValueNode) : bool
|
||||
{
|
||||
if (!$returnTagValueNode->type instanceof IdentifierTypeNode) {
|
||||
return \false;
|
||||
}
|
||||
return (string) $returnTagValueNode->type === 'null';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'f7b9dd9035931da5a040f5c714c79c32c424b677';
|
||||
public const PACKAGE_VERSION = 'e400e37e5fe1d329419874143c16d53242cf5b55';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-12-10 09:03:22';
|
||||
public const RELEASE_DATE = '2023-12-10 12:49:59';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue