mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 96fae07575c6c64ac7e2950388cbe07d18cbcfc5
96fae07575
Skip DateTime in ExpectedNameResolver (#5186)
This commit is contained in:
parent
7949049389
commit
d260adfd2b
|
@ -187,6 +187,13 @@ final class BreakingVariableRenameGuard
|
|||
}
|
||||
private function isGenerator(Param $param) : bool
|
||||
{
|
||||
return $this->nodeTypeResolver->isObjectType($param, new ObjectType('Symfony\\Component\\DependencyInjection\\Argument\\RewindableGenerator'));
|
||||
if (!$param->type instanceof Node) {
|
||||
return \false;
|
||||
}
|
||||
$paramType = $this->nodeTypeResolver->getType($param);
|
||||
if (!$paramType instanceof ObjectType) {
|
||||
return \false;
|
||||
}
|
||||
return $paramType->isInstanceOf('Symfony\\Component\\DependencyInjection\\Argument\\RewindableGenerator')->yes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,8 +119,7 @@ final class ExpectedNameResolver
|
|||
if ($returnedType instanceof MixedType) {
|
||||
return null;
|
||||
}
|
||||
if ($returnedType instanceof ObjectType && $returnedType->isInstanceOf('DateTimeInterface')->yes()) {
|
||||
// skip date time, as custom naming
|
||||
if ($this->isDateTimeType($returnedType)) {
|
||||
return null;
|
||||
}
|
||||
$expectedName = $this->propertyNaming->getExpectedNameFromType($returnedType);
|
||||
|
@ -195,4 +194,17 @@ final class ExpectedNameResolver
|
|||
}
|
||||
return $arrayType->getItemType();
|
||||
}
|
||||
/**
|
||||
* Skip date time, as custom naming
|
||||
*/
|
||||
private function isDateTimeType(Type $type) : bool
|
||||
{
|
||||
if (!$type instanceof ObjectType) {
|
||||
return \false;
|
||||
}
|
||||
if ($type->isInstanceOf('DateTimeInterface')->yes()) {
|
||||
return \true;
|
||||
}
|
||||
return $type->isInstanceOf('DateTime')->yes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c9b0c27fa1df366ccf2213888d4351311bf82966';
|
||||
public const PACKAGE_VERSION = '96fae07575c6c64ac7e2950388cbe07d18cbcfc5';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-10-18 08:22:57';
|
||||
public const RELEASE_DATE = '2023-10-18 09:24:02';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue