Updated Rector to commit beeba1770967a4f5e59cf21db28a5a1ccae48a2f

beeba17709 [Naming] Skip DateTime from renaming, to keep convention of named dates (#5184)
This commit is contained in:
Tomas Votruba 2023-10-18 08:05:23 +00:00
parent 079ad82aa5
commit 1e0199beb5
3 changed files with 12 additions and 4 deletions

View File

@ -3,9 +3,9 @@
declare (strict_types=1);
namespace Rector\DeadCode\Rector\If_;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;

View File

@ -5,6 +5,7 @@ namespace Rector\Naming\ExpectedNameResolver;
use PhpParser\Node\Param;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use Rector\Naming\Naming\PropertyNaming;
use Rector\Naming\ValueObject\ExpectedName;
use Rector\StaticTypeMapper\StaticTypeMapper;
@ -34,7 +35,7 @@ final class MatchParamTypeExpectedNameResolver
$staticType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type);
// include nullable too
// skip date time + date time interface, as should be kept
if ($staticType->isSuperTypeOf(new ObjectType('DateTimeInterface'))->yes()) {
if ($this->isDateTimeType($staticType)) {
return null;
}
$expectedName = $this->propertyNaming->getExpectedNameFromType($staticType);
@ -43,4 +44,11 @@ final class MatchParamTypeExpectedNameResolver
}
return $expectedName->getName();
}
private function isDateTimeType(Type $type) : bool
{
if ($type->isSuperTypeOf(new ObjectType('DateTimeInterface'))->yes()) {
return \true;
}
return $type->isSuperTypeOf(new ObjectType('DateTime'))->yes();
}
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '369f16a2640c381138bc12151109047ae5759f32';
public const PACKAGE_VERSION = 'beeba1770967a4f5e59cf21db28a5a1ccae48a2f';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-10-17 12:17:16';
public const RELEASE_DATE = '2023-10-18 08:02:31';
/**
* @var int
*/