-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle AlwaysRememberedExpr in deep Expr (#4310)
* add test fixture for match print * Fix deep AlwaysRememberedExpr * clean up * clean up --------- Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
- Loading branch information
1 parent
6a8724c
commit df459e7
Showing
4 changed files
with
72 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\PrintMatchPhpstan\Fixture; | ||
|
||
use ReflectionParameter; | ||
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator; | ||
use Symfony\Component\Config\Loader\FileLoader; | ||
|
||
final class DefinitionFileLoader | ||
{ | ||
/** | ||
* @param ReflectionParameter[] $parameters | ||
*/ | ||
private function executeCallback(array $parameters, $configurator): void | ||
{ | ||
$arguments = []; | ||
foreach ($parameters as $parameter) { | ||
$reflectionType = $parameter->getType(); | ||
|
||
$arguments[] = match ($reflectionType->getName()) { | ||
DefinitionConfigurator::class => $configurator, | ||
FileLoader::class, self::class => $this, | ||
}; | ||
} | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\Tests\Issues\PrintMatchPhpstan; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class PrintMatchPhpstanTest extends AbstractRectorTestCase | ||
{ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public static function provideData(): Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Set\ValueObject\DowngradeLevelSetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(DowngradeLevelSetList::DOWN_TO_PHP_81); | ||
}; |