1 | <?php |
||
22 | class CommitMessage |
||
23 | { |
||
24 | /** |
||
25 | * Commit Message content |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $content; |
||
30 | |||
31 | /** |
||
32 | * Content split lines |
||
33 | * |
||
34 | * @var string[] |
||
35 | */ |
||
36 | private $lines; |
||
37 | |||
38 | /** |
||
39 | * Amount of lines |
||
40 | * |
||
41 | * @var int |
||
42 | */ |
||
43 | private $lineCount; |
||
44 | |||
45 | /** |
||
46 | * CommitMessage constructor. |
||
47 | * |
||
48 | * @param string $content |
||
49 | */ |
||
50 | 12 | public function __construct(string $content) |
|
56 | |||
57 | /** |
||
58 | * Is message empty. |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 1 | public function isEmpty() : bool |
|
66 | |||
67 | /** |
||
68 | * Get complete commit message content. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 1 | public function getContent() : string |
|
76 | |||
77 | /** |
||
78 | * Return all lines. |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | 1 | public function getLines() : array |
|
86 | |||
87 | /** |
||
88 | * Return line count. |
||
89 | * |
||
90 | * @return int |
||
91 | */ |
||
92 | 2 | public function getLineCount() : int |
|
96 | |||
97 | /** |
||
98 | * Get a specific line. |
||
99 | * |
||
100 | * @param int $index |
||
101 | * @return string |
||
102 | */ |
||
103 | 1 | public function getLine(int $index) : string |
|
107 | |||
108 | /** |
||
109 | * Return first line. |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | 2 | public function getSubject() : string |
|
117 | |||
118 | /** |
||
119 | * Return content from line nr. 3 to the last line. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 2 | public function getBody() : string |
|
127 | |||
128 | /** |
||
129 | * Return lines from line nr. 3 to the last line. |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | 3 | public function getBodyLines() : array |
|
137 | |||
138 | /** |
||
139 | * Create CommitMessage from file. |
||
140 | * |
||
141 | * @param string $path |
||
142 | * @param string|null $commentChar Lines beginning with this character will be ignored |
||
143 | * @return \SebastianFeldmann\Git\CommitMessage |
||
144 | */ |
||
145 | 3 | public static function createFromFile(string $path, $commentChar = null) : CommitMessage |
|
163 | } |
||
164 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.