1515 * @internal
1616 *
1717 * @covers \PhpCsFixerCustomFixers\Fixer\NoUselessWriteVisibilityFixer
18+ *
19+ * @requires PHP >= 8.4
1820 */
1921final class NoUselessWriteVisibilityFixerTest extends AbstractFixerTestCase
2022{
@@ -24,8 +26,6 @@ public function testIsRisky(): void
2426 }
2527
2628 /**
27- * @requires PHP >= 8.4
28- *
2929 * @dataProvider provideFixCases
3030 */
3131 public function testFix (string $ expected , ?string $ input = null ): void
@@ -34,11 +34,11 @@ public function testFix(string $expected, ?string $input = null): void
3434 }
3535
3636 /**
37- * @return iterable<array{0: string, 1?: string}>
37+ * @return iterable<string, array{0: string, 1?: string}>
3838 */
3939 public static function provideFixCases (): iterable
4040 {
41- yield [
41+ yield ' class properties ' => [
4242 <<<'PHP'
4343 <?php class Foo {
4444 public $x;
@@ -55,7 +55,7 @@ public static function provideFixCases(): iterable
5555 PHP,
5656 ];
5757
58- yield [
58+ yield ' only write visibility ' => [
5959 <<<'PHP'
6060 <?php class Foo {
6161 public $x;
@@ -68,7 +68,7 @@ public static function provideFixCases(): iterable
6868 PHP,
6969 ];
7070
71- yield [
71+ yield ' promoted properties ' => [
7272 <<<'PHP'
7373 <?php class Foo {
7474 public function __construct(
@@ -88,5 +88,44 @@ public function __construct(
8888 }
8989 PHP,
9090 ];
91+
92+ yield 'readonly property ' => [
93+ <<<'PHP'
94+ <?php class Foo {
95+ public readonly $x { get => 'x'; }
96+ }
97+ PHP,
98+ <<<'PHP'
99+ <?php class Foo {
100+ public readonly public(set) $x { get => 'x'; }
101+ }
102+ PHP,
103+ ];
104+
105+ yield 'abstract property ' => [
106+ <<<'PHP'
107+ <?php abstract class Foo {
108+ public abstract $x { get => 'x'; }
109+ }
110+ PHP,
111+ <<<'PHP'
112+ <?php abstract class Foo {
113+ public abstract public(set) $x { get => 'x'; }
114+ }
115+ PHP,
116+ ];
117+
118+ yield 'abstract readonly property ' => [
119+ <<<'PHP'
120+ <?php abstract class Foo {
121+ public abstract readonly $x { get => 'x'; }
122+ }
123+ PHP,
124+ <<<'PHP'
125+ <?php abstract class Foo {
126+ public abstract readonly public(set) $x { get => 'x'; }
127+ }
128+ PHP,
129+ ];
91130 }
92131}
0 commit comments