Updated Rector to commit 005ccc330c3bb37f9faf0f5e2c319036f2d055b8

005ccc330c Rectify (#5324)
This commit is contained in:
Tomas Votruba 2023-12-04 14:56:20 +00:00
parent 1754c2c66a
commit 1095b54b14
4 changed files with 27 additions and 51 deletions

View File

@ -1,4 +1,4 @@
# 353 Rules Overview
# 351 Rules Overview
<br>
@ -6,7 +6,7 @@
- [Arguments](#arguments) (4)
- [CodeQuality](#codequality) (72)
- [CodeQuality](#codequality) (73)
- [CodingStyle](#codingstyle) (27)
@ -30,7 +30,7 @@
- [Php70](#php70) (19)
- [Php71](#php71) (8)
- [Php71](#php71) (7)
- [Php72](#php72) (9)
@ -56,7 +56,7 @@
- [Transform](#transform) (22)
- [TypeDeclaration](#typedeclaration) (40)
- [TypeDeclaration](#typedeclaration) (39)
- [Visibility](#visibility) (3)
@ -942,6 +942,19 @@ Remove `sprintf()` wrapper if not needed
<br>
### RemoveUselessIsObjectCheckRector
Remove useless `is_object()` check on combine with instanceof check
- class: [`Rector\CodeQuality\Rector\BooleanAnd\RemoveUselessIsObjectCheckRector`](../rules/CodeQuality/Rector/BooleanAnd/RemoveUselessIsObjectCheckRector.php)
```diff
-is_object($obj) && $obj instanceof DateTime
+$obj instanceof DateTime
```
<br>
### ReplaceMultipleBooleanNotRector
Replace the Double not operator (!!) by type-casting to boolean
@ -3818,7 +3831,7 @@ Changes PHP 4 style constructor to __construct.
### RandomFunctionRector
Changes rand, srand, mt_rand and getrandmax to newer alternatives.
Changes rand, srand, and getrandmax to newer alternatives
- class: [`Rector\Php70\Rector\FuncCall\RandomFunctionRector`](../rules/Php70/Rector/FuncCall/RandomFunctionRector.php)
@ -4005,20 +4018,6 @@ Change binary operation between some number + string to PHP 7.1 compatible versi
<br>
### CountOnNullRector
Changes `count()` on null to safe ternary check
- class: [`Rector\Php71\Rector\FuncCall\CountOnNullRector`](../rules/Php71/Rector/FuncCall/CountOnNullRector.php)
```diff
$values = null;
-$count = count($values);
+$count = $values === null ? 0 : count($values);
```
<br>
### IsIterableRector
Changes is_array + Traversable check to is_iterable
@ -6990,27 +6989,6 @@ Add typed properties based only on strict constructor types
<br>
### TypedPropertyFromStrictGetterMethodReturnTypeRector
Complete property type based on getter strict types
- class: [`Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector`](../rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php)
```diff
final class SomeClass
{
- public $name;
+ public ?string $name = null;
public function getName(): string|null
{
return $this->name;
}
}
```
<br>
### TypedPropertyFromStrictSetUpRector
Add strict typed property based on `setUp()` strict typed assigns in TestCase

View File

@ -3,8 +3,8 @@
declare (strict_types=1);
namespace Rector\DeadCode\PhpDoc;
use PhpParser\Node\Identifier;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
@ -131,14 +131,12 @@ final class DeadReturnTagValueNodeAnalyzer
*/
private function hasUsefullPhpdocType(ReturnTagValueNode $returnTagValueNode, $returnType) : bool
{
if ($this->isVoidReturnType($returnType)) {
if (!$returnTagValueNode->type instanceof IdentifierTypeNode || (string) $returnTagValueNode->type !== 'never') {
return \false;
}
if (!$this->isVoidReturnType($returnType)) {
return !$this->isNeverReturnType($returnType);
}
if ($this->isNeverReturnType($returnType)) {
if (!$returnTagValueNode->type instanceof IdentifierTypeNode || (string) $returnTagValueNode->type !== 'never') {
return \false;
}
return \true;
return !$this->isNeverReturnType($returnType);
}
}

View File

@ -3,10 +3,9 @@
declare (strict_types=1);
namespace Rector\DeadCode\Rector\If_;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Instanceof_;
@ -14,6 +13,7 @@ use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use PhpParser\NodeTraverser;
use PHPStan\Type\MixedType;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '526f4cd09c06842987e46d661b6ad87a8da723a7';
public const PACKAGE_VERSION = '005ccc330c3bb37f9faf0f5e2c319036f2d055b8';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-12-04 21:48:50';
public const RELEASE_DATE = '2023-12-04 21:54:02';
/**
* @var int
*/