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> <br>
@ -6,7 +6,7 @@
- [Arguments](#arguments) (4) - [Arguments](#arguments) (4)
- [CodeQuality](#codequality) (72) - [CodeQuality](#codequality) (73)
- [CodingStyle](#codingstyle) (27) - [CodingStyle](#codingstyle) (27)
@ -30,7 +30,7 @@
- [Php70](#php70) (19) - [Php70](#php70) (19)
- [Php71](#php71) (8) - [Php71](#php71) (7)
- [Php72](#php72) (9) - [Php72](#php72) (9)
@ -56,7 +56,7 @@
- [Transform](#transform) (22) - [Transform](#transform) (22)
- [TypeDeclaration](#typedeclaration) (40) - [TypeDeclaration](#typedeclaration) (39)
- [Visibility](#visibility) (3) - [Visibility](#visibility) (3)
@ -942,6 +942,19 @@ Remove `sprintf()` wrapper if not needed
<br> <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 ### ReplaceMultipleBooleanNotRector
Replace the Double not operator (!!) by type-casting to boolean Replace the Double not operator (!!) by type-casting to boolean
@ -3818,7 +3831,7 @@ Changes PHP 4 style constructor to __construct.
### RandomFunctionRector ### 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) - 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> <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 ### IsIterableRector
Changes is_array + Traversable check to is_iterable Changes is_array + Traversable check to is_iterable
@ -6990,27 +6989,6 @@ Add typed properties based only on strict constructor types
<br> <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 ### TypedPropertyFromStrictSetUpRector
Add strict typed property based on `setUp()` strict typed assigns in TestCase Add strict typed property based on `setUp()` strict typed assigns in TestCase

View File

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

View File

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

View File

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