From b364dbc4f3647aaafe55122b9161175f2c52bfd5 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 19 Oct 2025 22:56:12 +0700 Subject: [PATCH] Move mix DowngradeSetAccessibleReflectionPropertyRector+DowngradeMatchToSwitchRector tests from rector-src to here --- .../fixture.php.inc | 46 +++++++++++++++++++ .../MatchToSwitchReflectionTest.php | 28 +++++++++++ .../config/match_to_switch_reflection.php | 10 ++++ 3 files changed, 84 insertions(+) create mode 100644 tests/Issues/ScopeNotAvailable/FixtureMatchToSwitchReflection/fixture.php.inc create mode 100644 tests/Issues/ScopeNotAvailable/MatchToSwitchReflectionTest.php create mode 100644 tests/Issues/ScopeNotAvailable/config/match_to_switch_reflection.php diff --git a/tests/Issues/ScopeNotAvailable/FixtureMatchToSwitchReflection/fixture.php.inc b/tests/Issues/ScopeNotAvailable/FixtureMatchToSwitchReflection/fixture.php.inc new file mode 100644 index 00000000..46621dc2 --- /dev/null +++ b/tests/Issues/ScopeNotAvailable/FixtureMatchToSwitchReflection/fixture.php.inc @@ -0,0 +1,46 @@ +setValue($e, $message); + + throw $e; + } + } +} + +?> +----- +setAccessible(true); + } + $r->setValue($e, $message); + + throw $e; + } + } +} + +?> diff --git a/tests/Issues/ScopeNotAvailable/MatchToSwitchReflectionTest.php b/tests/Issues/ScopeNotAvailable/MatchToSwitchReflectionTest.php new file mode 100644 index 00000000..7c26f16d --- /dev/null +++ b/tests/Issues/ScopeNotAvailable/MatchToSwitchReflectionTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/FixtureMatchToSwitchReflection'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/match_to_switch_reflection.php'; + } +} diff --git a/tests/Issues/ScopeNotAvailable/config/match_to_switch_reflection.php b/tests/Issues/ScopeNotAvailable/config/match_to_switch_reflection.php new file mode 100644 index 00000000..b906042b --- /dev/null +++ b/tests/Issues/ScopeNotAvailable/config/match_to_switch_reflection.php @@ -0,0 +1,10 @@ +withRules([DowngradeSetAccessibleReflectionPropertyRector::class, DowngradeMatchToSwitchRector::class]);