Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
17 | public function getReplaceRedundantNullValuesDataProvider() { |
||
18 | return [ |
||
19 | [ |
||
20 | '<?php class A {protected static $b =null;}', |
||
21 | '<?php class A {protected static $b;}', |
||
22 | ], |
||
23 | [ |
||
24 | '<?php class A {public static $d= null ;}', |
||
25 | '<?php class A {public static $d;}', |
||
26 | ], |
||
27 | [ |
||
28 | '<?php class A {public $a=null;}', |
||
29 | '<?php class A {public $a;}', |
||
30 | ], |
||
31 | [ |
||
32 | '<?php class A {protected $b =null;}', |
||
33 | '<?php class A {protected $b;}', |
||
34 | ], |
||
35 | [ |
||
36 | '<?php class A {private $b =null;}', |
||
37 | '<?php class A {private $b;}', |
||
38 | ], |
||
39 | [ |
||
40 | '<?php echo 1;', |
||
41 | '<?php echo 1;', |
||
42 | ], |
||
43 | [ |
||
44 | '<?php class A {}', |
||
45 | '<?php class A {}', |
||
46 | ], |
||
47 | [ |
||
48 | '<?php class A {public $a=1;}', |
||
49 | '<?php class A {public $a=1;}', |
||
50 | ], |
||
51 | [ |
||
52 | '<?php class A {public $a=null;}', |
||
53 | '<?php class A {public $a;}', |
||
54 | ], |
||
55 | [ |
||
56 | '<?php class A { |
||
57 | public $a=null ; |
||
58 | } |
||
59 | ', |
||
60 | '<?php class A { |
||
61 | public $a; |
||
62 | } |
||
63 | ', |
||
64 | ], |
||
65 | |||
66 | ]; |
||
67 | } |
||
68 | |||
81 |