-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ChildDoctrineRepositoryClassTypeRector for generic type (#5746)
* add generics fixture * Skip generic type in ChildDoctrineRepositoryClassTypeRector
- Loading branch information
1 parent
2689095
commit f4070bb
Showing
5 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...ration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector/Fixture/skip_generics.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,27 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\ChildDoctrineRepositoryClassTypeRector\Fixture; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
|
||
/** | ||
* @template T of object | ||
* @extends EntityRepository<T> | ||
*/ | ||
final class ExtendedEntityRepository extends EntityRepository | ||
{ | ||
/** | ||
* Get an object or throws an exception | ||
* | ||
* @param array<string, mixed> $conditions | ||
* | ||
* @return T | ||
*/ | ||
public function findOneByOrThrow(array $conditions) { | ||
$entity = $this->findOneBy($conditions); | ||
if ($entity === null) { | ||
throw new \RuntimeException(); | ||
} | ||
return $entity; | ||
} | ||
} |
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
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
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
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