-
-
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.
[TypeDeclaration] Add AddParamTypeBasedOnPHPUnitDataProviderRector + …
…remove too narrow KnownArrayParamTypeInferer (#3104)
- Loading branch information
1 parent
2af3c7f
commit 48febdb
Showing
15 changed files
with
308 additions
and
266 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
34 changes: 0 additions & 34 deletions
34
...claration/Rector/ClassMethod/AddArrayParamDocTypeRector/Fixture/known_param_array.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
47 changes: 47 additions & 0 deletions
47
...n/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector/Fixture/fixture.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,47 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector\Fixture; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SomeTestWithDataProvider extends TestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test($name) | ||
{ | ||
} | ||
|
||
public function provideData(): Iterator | ||
{ | ||
yield ['some']; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector\Fixture; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SomeTestWithDataProvider extends TestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(string $name) | ||
{ | ||
} | ||
|
||
public function provideData(): Iterator | ||
{ | ||
yield ['some']; | ||
} | ||
} | ||
|
||
?> |
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
47 changes: 47 additions & 0 deletions
47
...tor/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector/Fixture/return_array.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,47 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector\Fixture; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ReturnArray extends TestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test($name, $number) | ||
{ | ||
} | ||
|
||
public function provideData() | ||
{ | ||
return [['some', 100]]; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector\Fixture; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ReturnArray extends TestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(string $name, int $number) | ||
{ | ||
} | ||
|
||
public function provideData() | ||
{ | ||
return [['some', 100]]; | ||
} | ||
} | ||
|
||
?> |
21 changes: 21 additions & 0 deletions
21
...tor/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector/Fixture/skip_no_type.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\Tests\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector\Fixture; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SkipNoType extends TestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test($name) | ||
{ | ||
} | ||
|
||
public function provideData($some): Iterator | ||
{ | ||
yield [$some]; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector/config/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Core\ValueObject\PhpVersionFeature; | ||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->rule(AddParamTypeBasedOnPHPUnitDataProviderRector::class); | ||
|
||
$rectorConfig->phpVersion(PhpVersionFeature::UNION_TYPES - 1); | ||
}; |
45 changes: 0 additions & 45 deletions
45
...aration/Rector/FunctionLike/ParamTypeDeclarationRector/Fixture/dataprovider_yield.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
Oops, something went wrong.