Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
25 | public function testGetMilestoneIssues(): void |
||
26 | { |
||
27 | $changelogConfig = new ChangelogConfig('jwage', 'changelog-generator', '1.0', []); |
||
28 | |||
29 | $this->issueFetcher->expects(self::once()) |
||
30 | ->method('fetchMilestoneIssues') |
||
31 | ->with($changelogConfig) |
||
32 | ->willReturn([ |
||
33 | [ |
||
34 | 'number' => 1, |
||
35 | 'title' => 'Issue #1', |
||
36 | 'body' => 'Issue #1 Body', |
||
37 | 'html_url' => 'https://github.com/jwage/changelog-generator/issue/1', |
||
38 | 'user' => ['login' => 'jwage'], |
||
39 | 'labels' => [['name' => 'Enhancement']], |
||
40 | ], |
||
41 | [ |
||
42 | 'number' => 2, |
||
43 | 'title' => '[Bug] Issue #2', |
||
44 | 'body' => 'Issue #2 Body', |
||
45 | 'html_url' => 'https://github.com/jwage/changelog-generator/issue/2', |
||
46 | 'user' => ['login' => 'jwage'], |
||
47 | 'labels' => [['name' => 'Bug']], |
||
48 | ], |
||
49 | ]); |
||
50 | |||
51 | $issue1 = $this->createMock(Issue::class); |
||
52 | $issue2 = $this->createMock(Issue::class); |
||
53 | |||
54 | $this->issueFactory->method('create') |
||
|
|||
55 | ->willReturnMap([ |
||
56 | [ |
||
57 | [ |
||
58 | 'number' => 1, |
||
59 | 'title' => 'Issue #1', |
||
60 | 'body' => 'Issue #1 Body', |
||
61 | 'html_url' => 'https://github.com/jwage/changelog-generator/issue/1', |
||
62 | 'user' => ['login' => 'jwage'], |
||
63 | 'labels' => [['name' => 'Enhancement']], |
||
64 | ], |
||
65 | $issue1, |
||
66 | ], |
||
67 | [ |
||
68 | [ |
||
69 | 'number' => 2, |
||
70 | 'title' => '[Bug] Issue #2', |
||
71 | 'body' => 'Issue #2 Body', |
||
72 | 'html_url' => 'https://github.com/jwage/changelog-generator/issue/2', |
||
73 | 'user' => ['login' => 'jwage'], |
||
74 | 'labels' => [['name' => 'Bug']], |
||
75 | ], |
||
76 | $issue2, |
||
77 | ], |
||
78 | ]); |
||
79 | |||
80 | $issues = $this->issueRepository->getMilestoneIssues($changelogConfig); |
||
81 | |||
82 | self::assertCount(2, $issues); |
||
83 | self::assertSame($issue1, $issues[1]); |
||
84 | self::assertSame($issue2, $issues[2]); |
||
85 | } |
||
98 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.