|
13 | 13 | use Roave\BetterReflection\Reflection\ReflectionClass; |
14 | 14 | use Roave\BetterReflection\Reflector\DefaultReflector; |
15 | 15 | use Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator; |
| 16 | +use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; |
16 | 17 |
|
17 | 18 | use function array_map; |
18 | 19 | use function iterator_to_array; |
@@ -60,6 +61,48 @@ public static function classesToBeTested(): array |
60 | 61 | '[BC] REMOVED: Method RoaveTestAsset\ClassWithMethodsBeingRemoved#removedProtectedMethod() was removed', |
61 | 62 | ], |
62 | 63 | ], |
| 64 | + 'final class with protected changing to private' => [ |
| 65 | + (new DefaultReflector(new StringSourceLocator( |
| 66 | + <<<'PHP' |
| 67 | + <?php |
| 68 | + final class FinalClassWithProtectedMethod { |
| 69 | + protected function foo(string $bar): void {} |
| 70 | + } |
| 71 | + PHP, |
| 72 | + $locator, |
| 73 | + )))->reflectClass('FinalClassWithProtectedMethod'), |
| 74 | + (new DefaultReflector(new StringSourceLocator( |
| 75 | + <<<'PHP' |
| 76 | + <?php |
| 77 | + final class FinalClassWithProtectedMethod { |
| 78 | + private function foo(string $bar): void {} |
| 79 | + } |
| 80 | + PHP, |
| 81 | + $locator, |
| 82 | + )))->reflectClass('FinalClassWithProtectedMethod'), |
| 83 | + [], |
| 84 | + ], |
| 85 | + 'final class with public changing to private' => [ |
| 86 | + (new DefaultReflector(new StringSourceLocator( |
| 87 | + <<<'PHP' |
| 88 | + <?php |
| 89 | + final class FinalClassWithPublicMethod { |
| 90 | + public function foo(string $bar): void {} |
| 91 | + } |
| 92 | + PHP, |
| 93 | + $locator, |
| 94 | + )))->reflectClass('FinalClassWithPublicMethod'), |
| 95 | + (new DefaultReflector(new StringSourceLocator( |
| 96 | + <<<'PHP' |
| 97 | + <?php |
| 98 | + final class FinalClassWithPublicMethod { |
| 99 | + private function foo(string $bar): void {} |
| 100 | + } |
| 101 | + PHP, |
| 102 | + $locator, |
| 103 | + )))->reflectClass('FinalClassWithPublicMethod'), |
| 104 | + ['[BC] REMOVED: Method FinalClassWithPublicMethod#foo() was removed'], |
| 105 | + ], |
63 | 106 | ]; |
64 | 107 | } |
65 | 108 | } |
0 commit comments