-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[type-declaration] Add typed property, if traits do not duplicate the…
… property (#6663) * [type-declaration] Add typed property using trait test fixture * Add typed property, if traits do not duplicate the property
- Loading branch information
1 parent
c59c83a
commit 8da1bfe
Showing
6 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...r/Property/TypedPropertyFromStrictConstructorRector/Fixture/include_trait_as_well.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,44 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\Fixture; | ||
|
||
use Doctrine\ORM\EntityManagerInterface; | ||
use Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\Source\TraitUsingEntityManager; | ||
|
||
final class IncludeTraitAsWell | ||
{ | ||
use TraitUsingEntityManager; | ||
|
||
/** | ||
* @var EntityManagerInterface | ||
*/ | ||
private $entityManager; | ||
|
||
public function __construct(EntityManagerInterface $entityManager) | ||
{ | ||
$this->entityManager = $entityManager; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\Fixture; | ||
|
||
use Doctrine\ORM\EntityManagerInterface; | ||
use Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\Source\TraitUsingEntityManager; | ||
|
||
final class IncludeTraitAsWell | ||
{ | ||
use TraitUsingEntityManager; | ||
|
||
private \Doctrine\ORM\EntityManagerInterface $entityManager; | ||
|
||
public function __construct(EntityManagerInterface $entityManager) | ||
{ | ||
$this->entityManager = $entityManager; | ||
} | ||
} | ||
|
||
?> |
11 changes: 11 additions & 0 deletions
11
...ctor/Property/TypedPropertyFromStrictConstructorRector/Source/TraitUsingEntityManager.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,11 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector\Source; | ||
|
||
trait TraitUsingEntityManager | ||
{ | ||
public function run() | ||
{ | ||
$this->entityManager->flush(); | ||
} | ||
} |
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