mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-22 02:52:23 +00:00
Updated Rector to commit 012e8bb2ed77516c792e3fb9c777066c3776abcc
012e8bb2ed
Skip non-final class method with no content in AddVoidReturnTypeWhereNoReturnRector (#5386)
This commit is contained in:
parent
f9f96d6bb9
commit
06a8e6394a
|
@ -86,7 +86,8 @@ CODE_SAMPLE
|
||||||
*/
|
*/
|
||||||
public function refactor(Node $node) : ?Node
|
public function refactor(Node $node) : ?Node
|
||||||
{
|
{
|
||||||
if ($node->returnType !== null) {
|
// already has return type → skip
|
||||||
|
if ($node->returnType instanceof Node) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($this->shouldSkipClassMethod($node)) {
|
if ($this->shouldSkipClassMethod($node)) {
|
||||||
|
@ -123,6 +124,10 @@ CODE_SAMPLE
|
||||||
if ($this->isNotFinalAndHasExceptionOnly($functionLike)) {
|
if ($this->isNotFinalAndHasExceptionOnly($functionLike)) {
|
||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
|
// possibly required by child implementation
|
||||||
|
if ($this->isNotFinalAndEmpty($functionLike)) {
|
||||||
|
return \true;
|
||||||
|
}
|
||||||
if ($functionLike->isProtected()) {
|
if ($functionLike->isProtected()) {
|
||||||
return !$this->classModifierChecker->isInsideFinalClass($functionLike);
|
return !$this->classModifierChecker->isInsideFinalClass($functionLike);
|
||||||
}
|
}
|
||||||
|
@ -139,4 +144,11 @@ CODE_SAMPLE
|
||||||
$onlyStmt = $classMethod->stmts[0] ?? null;
|
$onlyStmt = $classMethod->stmts[0] ?? null;
|
||||||
return $onlyStmt instanceof Throw_;
|
return $onlyStmt instanceof Throw_;
|
||||||
}
|
}
|
||||||
|
private function isNotFinalAndEmpty(ClassMethod $classMethod) : bool
|
||||||
|
{
|
||||||
|
if ($this->classModifierChecker->isInsideFinalClass($classMethod)) {
|
||||||
|
return \false;
|
||||||
|
}
|
||||||
|
return $classMethod->stmts === [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '00b442f2d79f1536e9dc59c2fa7ff541a0cba1e8';
|
public const PACKAGE_VERSION = '012e8bb2ed77516c792e3fb9c777066c3776abcc';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-12-24 01:49:14';
|
public const RELEASE_DATE = '2023-12-24 02:19:52';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user