Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for getOneOrNullResult() method in ChildDoctrineRepositor…
…yClassTypeRector (#5747)
- Loading branch information
1 parent
f4070bb
commit 0c17740
Showing
2 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...tion/Rector/Class_/ChildDoctrineRepositoryClassTypeRector/Fixture/get_one_or_null.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector\Fixture; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector\Source\SomeObject; | ||
|
||
/** | ||
* @extends EntityRepository<SomeObject> | ||
*/ | ||
final class GetOneOrNull extends EntityRepository | ||
{ | ||
public function findSome() | ||
{ | ||
return $this->createQueryBuilder() | ||
->getOneOrNullResult(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector\Fixture; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector\Source\SomeObject; | ||
|
||
/** | ||
* @extends EntityRepository<SomeObject> | ||
*/ | ||
final class GetOneOrNull extends EntityRepository | ||
{ | ||
public function findSome(): ?SomeObject | ||
{ | ||
return $this->createQueryBuilder() | ||
->getOneOrNullResult(); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters