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 55use Rector \CodingStyle \Rector \Catch_ \CatchExceptionNameMatchingTypeRector ;
66use Rector \CodingStyle \Rector \Stmt \NewlineAfterStatementRector ;
77use Rector \Config \RectorConfig ;
8+ use Rector \DeadCode \Rector \ClassMethod \RemoveUnusedPrivateMethodRector ;
89use Rector \EarlyReturn \Rector \If_ \ChangeOrIfContinueToMultiContinueRector ;
910use Rector \Php74 \Rector \Closure \ClosureToArrowFunctionRector ;
1011use Rector \Php81 \Rector \Array_ \FirstClassCallableRector ;
4748 ClosureToArrowFunctionRector::class,
4849 FirstClassCallableRector::class,
4950 NewlineAfterStatementRector::class,
51+ RemoveUnusedPrivateMethodRector::class => [
52+ __DIR__ .'/tests/MethodsTest.php ' ,
53+ ],
5054 ]);
Original file line number Diff line number Diff line change 66
77class Pipe
88{
9- protected mixed $ value ;
10-
11- public function __construct (mixed $ value )
9+ public function __construct (protected mixed $ value )
1210 {
13- $ this ->value = $ value ;
14-
1511 if (! defined ('PIPED_VALUE ' )) {
1612 define ('PIPED_VALUE ' , 'PIPED_VALUE- ' .uniqid ('' , true ));
1713 }
Original file line number Diff line number Diff line change 88
99class PipeProxy
1010{
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 ) {}
1912
2013 public function __call (string $ method , array $ arguments ): Pipe
2114 {
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
8888 $ this ->assertSame (
8989 'prefixed-string ' ,
9090 take ('string ' )
91- ->pipe (function (string $ value ) {
91+ ->pipe (function (string $ value ): string {
9292 return 'prefixed- ' .$ value ;
9393 })
9494 ->get ()
@@ -147,6 +147,11 @@ public function it can transform a value using a proxied public class
147147 );
148148 }
149149
150+ public function uppercase (string $ value ): string
151+ {
152+ return mb_strtoupper ($ value );
153+ }
154+
150155 /**
151156 * @test
152157 */
@@ -174,6 +179,16 @@ public function it can transform a value using a proxied private class
174179 );
175180 }
176181
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+
177192 /**
178193 * @test
179194 */
@@ -199,19 +214,4 @@ public function it can transform a value while accepting pipe parameters
199214 ->get ()
200215 );
201216 }
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- }
217217}
You can’t perform that action at this time.
0 commit comments