-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing extra import on NestedAnnotationToAttributeRector (#2989)
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr> Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
ea25cb0
commit f4f758c
Showing
9 changed files
with
178 additions
and
32 deletions.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
...stedAnnotationToAttributeRector/Fixture/doctrine_join_column_nested_in_join_table.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,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Property\NestedAnnotationToAttributeRector\Fixture; | ||
|
||
use Doctrine\ORM\Mapping\JoinColumn; | ||
use Doctrine\ORM\Mapping\JoinTable; | ||
|
||
final class DoctrineJoinColumnNestedInJoinTable | ||
{ | ||
/** | ||
* @JoinTable(name="lemma_type", | ||
* inverseJoinColumns={@JoinColumn(name="lemma_id", referencedColumnName="lemma_id")} | ||
* ) | ||
*/ | ||
private iterable $lemmas; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Property\NestedAnnotationToAttributeRector\Fixture; | ||
|
||
use Doctrine\ORM\Mapping\InverseJoinColumn; | ||
use Doctrine\ORM\Mapping\JoinColumn; | ||
use Doctrine\ORM\Mapping\JoinTable; | ||
|
||
final class DoctrineJoinColumnNestedInJoinTable | ||
{ | ||
#[JoinTable(name: 'lemma_type')] | ||
#[InverseJoinColumn(name: 'lemma_id', referencedColumnName: 'lemma_id')] | ||
private iterable $lemmas; | ||
} | ||
|
||
?> |
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
33 changes: 33 additions & 0 deletions
33
rules/Php80/ValueObject/AnnotationPropertyToAttributeClass.php
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Php80\ValueObject; | ||
|
||
use Rector\Core\Validation\RectorAssert; | ||
|
||
final class AnnotationPropertyToAttributeClass | ||
{ | ||
public function __construct( | ||
private readonly string $attributeClass, | ||
private readonly string|int|null $annotationProperty = null, | ||
private readonly bool $doesNeedNewImport = false | ||
) { | ||
RectorAssert::className($attributeClass); | ||
} | ||
|
||
public function getAnnotationProperty(): string|int|null | ||
{ | ||
return $this->annotationProperty; | ||
} | ||
|
||
public function getAttributeClass(): string | ||
{ | ||
return $this->attributeClass; | ||
} | ||
|
||
public function doesNeedNewImport(): bool | ||
{ | ||
return $this->doesNeedNewImport; | ||
} | ||
} |
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