mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-19 23:09:43 +01:00
Updated Rector to commit 8decc9a693522fec96cc241ce40bc00b36fa7ad9
8decc9a693
[naming] Skip DateTime in RenamePropertyToMatchTypeRector as often named in custom way (#6787)
This commit is contained in:
parent
a4e557403b
commit
7950d5a841
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user