File tree Expand file tree Collapse file tree 4 files changed +22
-29
lines changed Expand file tree Collapse file tree 4 files changed +22
-29
lines changed Original file line number Diff line number Diff line change 5
5
use Rector \CodingStyle \Rector \Catch_ \CatchExceptionNameMatchingTypeRector ;
6
6
use Rector \CodingStyle \Rector \Stmt \NewlineAfterStatementRector ;
7
7
use Rector \Config \RectorConfig ;
8
+ use Rector \DeadCode \Rector \ClassMethod \RemoveUnusedPrivateMethodRector ;
8
9
use Rector \EarlyReturn \Rector \If_ \ChangeOrIfContinueToMultiContinueRector ;
9
10
use Rector \Php74 \Rector \Closure \ClosureToArrowFunctionRector ;
10
11
use Rector \Php81 \Rector \Array_ \FirstClassCallableRector ;
47
48
ClosureToArrowFunctionRector::class,
48
49
FirstClassCallableRector::class,
49
50
NewlineAfterStatementRector::class,
51
+ RemoveUnusedPrivateMethodRector::class => [
52
+ __DIR__ .'/tests/MethodsTest.php ' ,
53
+ ],
50
54
]);
Original file line number Diff line number Diff line change 6
6
7
7
class Pipe
8
8
{
9
- protected mixed $ value ;
10
-
11
- public function __construct (mixed $ value )
9
+ public function __construct (protected mixed $ value )
12
10
{
13
- $ this ->value = $ value ;
14
-
15
11
if (! defined ('PIPED_VALUE ' )) {
16
12
define ('PIPED_VALUE ' , 'PIPED_VALUE- ' .uniqid ('' , true ));
17
13
}
Original file line number Diff line number Diff line change 8
8
9
9
class PipeProxy
10
10
{
11
- protected Pipe $ item ;
12
- protected object $ object ;
13
-
14
- public function __construct (Pipe $ item , object $ object )
15
- {
16
- $ this ->item = $ item ;
17
- $ this ->object = $ object ;
18
- }
11
+ public function __construct (protected Pipe $ item , protected object $ object ) {}
19
12
20
13
public function __call (string $ method , array $ arguments ): Pipe
21
14
{
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ public function it can transform a value using a closure(): void
88
88
$ this ->assertSame (
89
89
'prefixed-string ' ,
90
90
take ('string ' )
91
- ->pipe (function (string $ value ) {
91
+ ->pipe (function (string $ value ): string {
92
92
return 'prefixed- ' .$ value ;
93
93
})
94
94
->get ()
@@ -147,6 +147,11 @@ public function it can transform a value using a proxied public class
147
147
);
148
148
}
149
149
150
+ public function uppercase (string $ value ): string
151
+ {
152
+ return mb_strtoupper ($ value );
153
+ }
154
+
150
155
/**
151
156
* @test
152
157
*/
@@ -174,6 +179,16 @@ public function it can transform a value using a proxied private class
174
179
);
175
180
}
176
181
182
+ private function lowercase (string $ value ): string
183
+ {
184
+ return mb_strtolower ($ value );
185
+ }
186
+
187
+ private function join (string ...$ values ): string
188
+ {
189
+ return implode ('- ' , $ values );
190
+ }
191
+
177
192
/**
178
193
* @test
179
194
*/
@@ -199,19 +214,4 @@ public function it can transform a value while accepting pipe parameters
199
214
->get ()
200
215
);
201
216
}
202
-
203
- public function uppercase (string $ value ): string
204
- {
205
- return mb_strtoupper ($ value );
206
- }
207
-
208
- private function lowercase (string $ value ): string
209
- {
210
- return mb_strtolower ($ value );
211
- }
212
-
213
- private function join (string ...$ values ): string
214
- {
215
- return implode ('- ' , $ values );
216
- }
217
217
}
You can’t perform that action at this time.
0 commit comments