Conditions | 1 |
Paths | 1 |
Total Lines | 75 |
Code Lines | 49 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 |
||
48 | public function dataProvider(): array |
||
49 | { |
||
50 | return [ |
||
51 | // [<expected result>, <file>, <line>, <type>] |
||
52 | [ |
||
53 | false, |
||
54 | self::FILE_3, |
||
55 | self::LINE_1, |
||
56 | self::TYPE_1, |
||
57 | ], |
||
58 | [ |
||
59 | true, |
||
60 | self::FILE_1, |
||
61 | self::LINE_1, |
||
62 | self::TYPE_1, |
||
63 | ], |
||
64 | [ |
||
65 | true, |
||
66 | self::FILE_1, |
||
67 | self::LINE_1, |
||
68 | self::TYPE_1, |
||
69 | ], |
||
70 | [ |
||
71 | false, |
||
72 | self::FILE_2, |
||
73 | self::LINE_1, |
||
74 | self::TYPE_1, |
||
75 | ], |
||
76 | [ |
||
77 | false, |
||
78 | self::FILE_1, |
||
79 | self::LINE_2, |
||
80 | self::TYPE_1, |
||
81 | ], |
||
82 | [ |
||
83 | false, |
||
84 | self::FILE_2, |
||
85 | self::LINE_2, |
||
86 | self::TYPE_1, |
||
87 | ], |
||
88 | [ |
||
89 | false, |
||
90 | self::FILE_1, |
||
91 | self::LINE_1, |
||
92 | self::TYPE_2, |
||
93 | ], |
||
94 | [ |
||
95 | false, |
||
96 | self::FILE_2, |
||
97 | self::LINE_1, |
||
98 | self::TYPE_2, |
||
99 | ], |
||
100 | [ |
||
101 | false, |
||
102 | self::FILE_1, |
||
103 | self::LINE_2, |
||
104 | self::TYPE_2, |
||
105 | ], |
||
106 | [ |
||
107 | false, |
||
108 | self::FILE_4, |
||
109 | self::LINE_1, |
||
110 | self::TYPE_1, |
||
111 | ], |
||
112 | [ |
||
113 | true, |
||
114 | self::FILE_4, |
||
115 | self::LINE_2, |
||
116 | self::TYPE_1, |
||
117 | ], |
||
118 | [ |
||
119 | true, |
||
120 | self::FILE_4, |
||
121 | self::LINE_2, |
||
122 | self::TYPE_2, |
||
123 | ], |
||
141 |