Updated Rector to commit 8decc9a693522fec96cc241ce40bc00b36fa7ad9

8decc9a693 [naming] Skip DateTime in RenamePropertyToMatchTypeRector as often named in custom way (#6787)
This commit is contained in:
Tomas Votruba 2025-03-17 11:28:58 +00:00
parent a4e557403b
commit 7950d5a841
2 changed files with 9 additions and 5 deletions

View File

@ -3,6 +3,7 @@
declare (strict_types=1);
namespace Rector\Naming\Rector\Class_;
use DateTime;
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
@ -113,7 +114,7 @@ CODE_SAMPLE
if (!$propertyRename instanceof PropertyRename) {
continue;
}
if ($this->skipMockObjectProperty($property)) {
if ($this->skipDateTimeOrMockObjectPropertyType($property)) {
continue;
}
$renameProperty = $this->matchTypePropertyRenamer->rename($propertyRename);
@ -127,11 +128,14 @@ CODE_SAMPLE
* Such properties can have "xMock" names that are not compatible with "MockObject" suffix
* They should be kept and handled by another naming rule that deals with mocks
*/
private function skipMockObjectProperty(Property $property) : bool
private function skipDateTimeOrMockObjectPropertyType(Property $property) : bool
{
if (!$property->type instanceof Name) {
return \false;
}
return $this->isName($property->type, ClassName::MOCK_OBJECT);
if ($this->isName($property->type, ClassName::MOCK_OBJECT)) {
return \true;
}
return $this->isName($property->type, DateTime::class);
}
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '3fc24e1460dcf672b75bbe7d374a9bea4a403573';
public const PACKAGE_VERSION = '8decc9a693522fec96cc241ce40bc00b36fa7ad9';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2025-03-17 12:15:54';
public const RELEASE_DATE = '2025-03-17 11:26:26';
/**
* @var int
*/