-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adjust AddGenericReturnTypeToRelationsRector rule to be able to…
… generate new generic style code (#263) * feat: adjust AddGenericReturnTypeToRelationsRector rule to be able to generate new generic style code * make rule configuration default to false to keep BC
- Loading branch information
Showing
28 changed files
with
732 additions
and
47 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
11 changes: 11 additions & 0 deletions
11
stubs/Illuminate/Database/Eloquent/Relations/HasOneThrough.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 Illuminate\Database\Eloquent\Relations; | ||
|
||
if (class_exists('Illuminate\Database\Eloquent\Relations\HasOneThrough')) { | ||
return; | ||
} | ||
|
||
class HasOneThrough extends Relation | ||
{ | ||
} |
32 changes: 32 additions & 0 deletions
32
...nericReturnTypeToRelationsRector/AddGenericReturnTypeToRelationsRectorNewGenericsTest.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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RectorLaravel\Tests\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class AddGenericReturnTypeToRelationsRectorNewGenericsTest extends AbstractRectorTestCase | ||
{ | ||
public static function provideData(): Iterator | ||
{ | ||
// yield [__DIR__ . '/Fixture/NewGenerics/has-one-through.php.inc']; | ||
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture/NewGenerics'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/use_new_generics_configured_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
Oops, something went wrong.