From 00697fa4b62e59d50efd512a126cab0cd2b454d0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 21 Mar 2024 10:03:58 +0000 Subject: [PATCH] Updated Rector to commit 0c177409ed477e978433597639335fb2a78bc331 https://github.com/rectorphp/rector-src/commit/0c177409ed477e978433597639335fb2a78bc331 Add support for getOneOrNullResult() method in ChildDoctrineRepositoryClassTypeRector (#5747) --- .../Class_/ChildDoctrineRepositoryClassTypeRector.php | 6 ++++-- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php index f2aba0ef6ef..f765b42f9a2 100644 --- a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php @@ -51,7 +51,7 @@ final class ChildDoctrineRepositoryClassTypeRector extends AbstractRector } public function getRuleDefinition() : RuleDefinition { - return new RuleDefinition('Add return type to classes that extend Doctrine\\ORM\\EntityRepository', [new CodeSample(<<<'CODE_SAMPLE' + return new RuleDefinition('Add return type to classes that extend Doctrine\\ORM\\EntityRepository based on return Doctrine method names', [new CodeSample(<<<'CODE_SAMPLE' use Doctrine\ORM\EntityRepository; /** @@ -109,7 +109,9 @@ CODE_SAMPLE if ($this->shouldSkipClassMethod($classMethod)) { continue; } - if ($this->containsMethodCallNamed($classMethod, 'findOneBy')) { + if ($this->containsMethodCallNamed($classMethod, 'getOneOrNullResult')) { + $classMethod->returnType = $this->createNullableType($entityClassName); + } elseif ($this->containsMethodCallNamed($classMethod, 'findOneBy')) { $classMethod->returnType = $this->createNullableType($entityClassName); } if ($this->containsMethodCallNamed($classMethod, 'findBy')) { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 04f7b4a9aca..836bdf64a07 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'f4070bb2b2f5c8f7a11063ce35549364c437a9cf'; + public const PACKAGE_VERSION = '0c177409ed477e978433597639335fb2a78bc331'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-03-21 10:52:56'; + public const RELEASE_DATE = '2024-03-21 11:01:32'; /** * @var int */