Conditions | 1 |
Paths | 1 |
Total Lines | 111 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
19 | public function dataFormatterOutputProvider(): Generator |
||
20 | { |
||
21 | yield [ |
||
22 | 'No errors', |
||
23 | 0, |
||
24 | 0, |
||
25 | 0, |
||
26 | '<?xml version="1.0" encoding="UTF-8"?> |
||
27 | <testsuite failures="0" name="phpstan" tests="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
28 | <testcase name="phpstan"/> |
||
29 | </testsuite> |
||
30 | ', |
||
31 | ]; |
||
32 | |||
33 | yield [ |
||
34 | 'One file error', |
||
35 | 1, |
||
36 | 1, |
||
37 | 0, |
||
38 | '<?xml version="1.0" encoding="UTF-8"?> |
||
39 | <testsuite failures="1" name="phpstan" tests="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
40 | <testcase name="folder with unicode 😃/file name with "spaces" and unicode 😃.php:4"> |
||
41 | <failure message="Foo" /> |
||
42 | </testcase> |
||
43 | </testsuite> |
||
44 | ', |
||
45 | ]; |
||
46 | |||
47 | yield [ |
||
48 | 'One generic error', |
||
49 | 1, |
||
50 | 0, |
||
51 | 1, |
||
52 | '<?xml version="1.0" encoding="UTF-8"?> |
||
53 | <testsuite failures="1" name="phpstan" tests="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
54 | <testcase name="Generic error"> |
||
55 | <failure message="first generic error" /> |
||
56 | </testcase> |
||
57 | </testsuite> |
||
58 | ', |
||
59 | ]; |
||
60 | |||
61 | yield [ |
||
62 | 'Multiple file errors', |
||
63 | 1, |
||
64 | 4, |
||
65 | 0, |
||
66 | '<?xml version="1.0" encoding="UTF-8"?> |
||
67 | <testsuite failures="4" name="phpstan" tests="4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
68 | <testcase name="folder with unicode 😃/file name with "spaces" and unicode 😃.php:4"> |
||
69 | <failure message="Foo" /> |
||
70 | </testcase> |
||
71 | <testcase name="foo.php:1"> |
||
72 | <failure message="Foo"/> |
||
73 | </testcase> |
||
74 | <testcase name="foo.php:5"> |
||
75 | <failure message="Bar"/> |
||
76 | </testcase> |
||
77 | <testcase name="folder with unicode 😃/file name with "spaces" and unicode 😃.php:2"> |
||
78 | <failure message="Bar" /> |
||
79 | </testcase> |
||
80 | </testsuite> |
||
81 | ', |
||
82 | ]; |
||
83 | |||
84 | yield [ |
||
85 | 'Multiple generic errors', |
||
86 | 1, |
||
87 | 0, |
||
88 | 2, |
||
89 | '<?xml version="1.0" encoding="UTF-8"?> |
||
90 | <testsuite failures="2" name="phpstan" tests="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
91 | <testcase name="Generic error"> |
||
92 | <failure message="first generic error" /> |
||
93 | </testcase> |
||
94 | <testcase name="Generic error"> |
||
95 | <failure message="second generic error"/> |
||
96 | </testcase> |
||
97 | </testsuite> |
||
98 | ', |
||
99 | ]; |
||
100 | |||
101 | yield [ |
||
102 | 'Multiple file, multiple generic errors', |
||
103 | 1, |
||
104 | 4, |
||
105 | 2, |
||
106 | '<?xml version="1.0" encoding="UTF-8"?> |
||
107 | <testsuite failures="6" name="phpstan" tests="6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"> |
||
108 | <testcase name="folder with unicode 😃/file name with "spaces" and unicode 😃.php:4"> |
||
109 | <failure message="Foo" /> |
||
110 | </testcase> |
||
111 | <testcase name="foo.php:1"> |
||
112 | <failure message="Foo"/> |
||
113 | </testcase> |
||
114 | <testcase name="foo.php:5"> |
||
115 | <failure message="Bar"/> |
||
116 | </testcase> |
||
117 | <testcase name="folder with unicode 😃/file name with "spaces" and unicode 😃.php:2"> |
||
118 | <failure message="Bar" /> |
||
119 | </testcase> |
||
120 | <testcase name="Generic error"> |
||
121 | <failure message="first generic error" /> |
||
122 | </testcase> |
||
123 | <testcase name="Generic error"> |
||
124 | <failure message="second generic error"/> |
||
125 | </testcase> |
||
126 | </testsuite> |
||
127 | ', |
||
128 | ]; |
||
129 | } |
||
130 | |||
164 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.