-
-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Privatization] Skip privatization in abstract only on open-source ty…
…pe (#5514)
- Loading branch information
1 parent
4735479
commit 1586fa7
Showing
8 changed files
with
97 additions
and
22 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
21 changes: 21 additions & 0 deletions
21
...r/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/include_abstract.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,21 @@ | ||
<?php | ||
|
||
namespace Rector\Privatization\Tests\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector\Fixture; | ||
|
||
abstract class IncludeAbstract | ||
{ | ||
public $property; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Privatization\Tests\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector\Fixture; | ||
|
||
abstract class IncludeAbstract | ||
{ | ||
private $property; | ||
} | ||
|
||
?> |
8 changes: 0 additions & 8 deletions
8
...ctor/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract.php.inc
This file was deleted.
Oops, something went wrong.
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
8 changes: 8 additions & 0 deletions
8
...izeLocalPropertyToPrivatePropertyRector/FixtureOpenSource/skip_protected_abstract.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,8 @@ | ||
<?php | ||
|
||
namespace Rector\Privatization\Tests\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector\FixtureOpenSource; | ||
|
||
abstract class SkipProtectedAbstract | ||
{ | ||
protected $property; | ||
} |
30 changes: 30 additions & 0 deletions
30
...ts/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/OpenSourceRectorTest.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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Privatization\Tests\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector; | ||
|
||
use Iterator; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class OpenSourceRectorTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
public function provideData(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureOpenSource'); | ||
} | ||
|
||
protected function provideConfigFileInfo(): ?SmartFileInfo | ||
{ | ||
return new SmartFileInfo(__DIR__ . '/config/fixture_open_source.php'); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...tor/Property/PrivatizeLocalPropertyToPrivatePropertyRector/config/fixture_open_source.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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Core\Configuration\Option; | ||
use Rector\Core\ValueObject\ProjectType; | ||
use Rector\Privatization\Rector\Property\PrivatizeLocalPropertyToPrivatePropertyRector; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$parameters = $containerConfigurator->parameters(); | ||
$parameters->set(Option::PROJECT_TYPE, ProjectType::OPEN_SOURCE); | ||
|
||
$services = $containerConfigurator->services(); | ||
$services->set(PrivatizeLocalPropertyToPrivatePropertyRector::class); | ||
}; |