-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep selectable intersection when improving doctrine collection doc type
- Loading branch information
1 parent
ef84d74
commit 64af294
Showing
6 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...yRector/Fixture/OneToMany/Attribute/skip_collection_generic_class_with_selectable.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,24 @@ | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector\Fixture\OneToMany\Attribute; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\Common\Collections\Selectable; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use Rector\Doctrine\Tests\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector\Source\CountryRef; | ||
|
||
#[ORM\Entity] | ||
class SkipCollectionGenericClass | ||
{ | ||
/** | ||
* @var Collection<int, CountryRef>&Selectable<int, CountryRef> | ||
*/ | ||
#[ORM\OneToMany(mappedBy: 'country', targetEntity: CountryRef::class, cascade: ['persist'])] | ||
private Collection&Selectable $countryRefs; | ||
|
||
public function __construct() | ||
{ | ||
$this->countryRefs = new ArrayCollection(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...Rector/Fixture/OneToMany/Attribute/skip_collection_generic_object_with_selectable.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,25 @@ | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector\Fixture\OneToMany\Attribute; | ||
|
||
use DateTimeImmutable; | ||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\Common\Collections\Selectable; | ||
use Doctrine\DBAL\Types\Types; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity] | ||
class SkipCollectionGenericObject | ||
{ | ||
/** | ||
* @var Collection<int, object>&Selectable<int, object> | ||
*/ | ||
#[ORM\OneToMany(mappedBy: 'port', targetEntity: object::class)] | ||
private Collection&Selectable $oi; | ||
|
||
public function __construct() | ||
{ | ||
$this->oi = new ArrayCollection(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Common\Collections; | ||
|
||
if (interface_exists('Doctrine\Common\Collections\Selectable')) { | ||
return; | ||
} | ||
|
||
interface Selectable | ||
{ | ||
|
||
} |