Conditions | 1 |
Paths | 1 |
Total Lines | 72 |
Code Lines | 48 |
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 |
||
15 | public function dataProvider(): iterable |
||
16 | { |
||
17 | yield [ |
||
18 | null, |
||
19 | null, |
||
20 | true, |
||
21 | ]; |
||
22 | |||
23 | yield [ |
||
24 | null, |
||
25 | 'Foo', |
||
26 | false, |
||
27 | ]; |
||
28 | |||
29 | yield [ |
||
30 | 'Bar', |
||
31 | null, |
||
32 | false, |
||
33 | ]; |
||
34 | |||
35 | yield [ |
||
36 | 'Foo/bar', |
||
37 | 'Foo/bar', |
||
38 | true, |
||
39 | ]; |
||
40 | |||
41 | yield [ |
||
42 | 'Foo/baz', |
||
43 | 'Foo/bar', |
||
44 | false, |
||
45 | ]; |
||
46 | |||
47 | yield [ |
||
48 | 'Foo/bar', |
||
49 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Domain', |
||
50 | false, |
||
51 | ]; |
||
52 | |||
53 | yield [ |
||
54 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Domain', |
||
55 | 'Foo/bar', |
||
56 | false, |
||
57 | ]; |
||
58 | |||
59 | yield [ |
||
60 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Infrastructure', |
||
61 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Domain', |
||
62 | true, |
||
63 | ]; |
||
64 | |||
65 | yield [ |
||
66 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Infrastructure\Foo', |
||
67 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA', |
||
68 | true, |
||
69 | ]; |
||
70 | |||
71 | yield [ |
||
72 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA', |
||
73 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Infrastructure', |
||
74 | true, |
||
75 | ]; |
||
76 | |||
77 | yield [ |
||
78 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Infrastructure', |
||
79 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleB\Infrastructure', |
||
80 | false, |
||
81 | ]; |
||
82 | |||
83 | yield [ |
||
84 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\Infrastructure\Person', |
||
85 | 'GacelaPhpstan\Tests\EnforceModuleBoundariesForMethodCallRule\Fixtures\ModuleA\SomeClass', |
||
86 | true, |
||
87 | ]; |
||
108 |