-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DISABLE_AUTO_IMPORT_DOC_BLOCK_NAMES option (#2526)
* -add DISABLE_AUTO_IMPORT_DOC_BLOCK_NAMES option * -refactoring * -refactoring * -refactoring
- Loading branch information
Showing
9 changed files
with
121 additions
and
7 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
33 changes: 33 additions & 0 deletions
33
tests/Issues/DisableAutoImportDocBlock/DisableAutoImportDocBlockTest.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\Core\Tests\Issues\DisableAutoImportDocBlock; | ||
|
||
use Iterator; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class DisableAutoImportDocBlockTest extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
/** | ||
* @return Iterator<SmartFileInfo> | ||
*/ | ||
public function provideData(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/configure_rule.php'; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/Issues/DisableAutoImportDocBlock/Fixture/do_not_import_doc_after_rename.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,26 @@ | ||
<?php | ||
|
||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
/** | ||
* @Route("/someUrl") | ||
*/ | ||
class SomeController extends Controller | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
/** | ||
* @\Symfony\Component\Routing\Annotation\Route("/someUrl") | ||
*/ | ||
class SomeController extends Controller | ||
{ | ||
} | ||
|
||
?> |
17 changes: 17 additions & 0 deletions
17
tests/Issues/DisableAutoImportDocBlock/Fixture/do_not_import_doc_block.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,17 @@ | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\DisableAutoImportDocBlock\Fixture; | ||
|
||
final class SomeClass | ||
{ | ||
/** | ||
* @throws \PHPUnit\Framework\InvalidArgumentException | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function run() | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
|
13 changes: 13 additions & 0 deletions
13
tests/Issues/DisableAutoImportDocBlock/Fixture/skip_import_of_aliased.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,13 @@ | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\DisableAutoImportDocBlock\Fixture; | ||
|
||
use ScrumWorks\OpenApiSchema\Annotation as OA; | ||
|
||
final class WalletStaticDataView | ||
{ | ||
/** | ||
* @OA\Property(description="Map transaction type to label") | ||
*/ | ||
public array $transactionLabelMap; | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/Issues/DisableAutoImportDocBlock/config/configure_rule.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 | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->importNames(true, false); | ||
$rectorConfig->rule(ReplaceSensioRouteAnnotationWithSymfonyRector::class); | ||
}; |