1 | <?php |
||
18 | class IssueCloner |
||
19 | { |
||
20 | |||
21 | const LINK_DIRECTION_INWARD = 1; |
||
22 | |||
23 | const LINK_DIRECTION_OUTWARD = 2; |
||
24 | |||
25 | /** |
||
26 | * Jira REST client. |
||
27 | * |
||
28 | * @var Api |
||
29 | */ |
||
30 | protected $jiraApi; |
||
31 | |||
32 | /** |
||
33 | * Specifies custom fields to copy during backporting. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | private $_copyCustomFields = array( |
||
38 | 'Change Log Group', 'Change Log Message', |
||
39 | ); |
||
40 | |||
41 | /** |
||
42 | * Custom fields map. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | private $_customFieldsMap = array(); |
||
47 | |||
48 | /** |
||
49 | * Fields to query during issue search. |
||
50 | * |
||
51 | * @var array |
||
52 | */ |
||
53 | protected $queryFields = array('summary', 'issuelinks'); |
||
54 | |||
55 | /** |
||
56 | * IssueCloner constructor. |
||
57 | * |
||
58 | * @param Api $jira_api Jira REST client. |
||
59 | */ |
||
60 | public function __construct(Api $jira_api) |
||
66 | |||
67 | /** |
||
68 | * Returns issues. |
||
69 | * |
||
70 | * @param string $jql JQL. |
||
71 | * @param string $link_name Link name. |
||
72 | * @param integer $link_direction Link direction. |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getIssues($jql, $link_name, $link_direction) |
||
97 | |||
98 | /** |
||
99 | * Builds custom field map. |
||
100 | * |
||
101 | * @return void |
||
102 | */ |
||
103 | private function _buildCustomFieldsMap() |
||
111 | |||
112 | /** |
||
113 | * Returns query fields. |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | private function _getQueryFields() |
||
129 | |||
130 | /** |
||
131 | * Returns issue, which backports given issue. |
||
132 | * |
||
133 | * @param Issue $issue Issue. |
||
134 | * @param string $link_name Link name. |
||
135 | * @param integer $link_direction Link direction. |
||
136 | * |
||
137 | * @return Issue|null |
||
138 | * @throws \InvalidArgumentException When link direction isn't valid. |
||
139 | */ |
||
140 | private function _getLinkedIssue(Issue $issue, $link_name, $link_direction) |
||
168 | |||
169 | /** |
||
170 | * Creates backports issues. |
||
171 | * |
||
172 | * @param Issue $issue Issue. |
||
173 | * @param string $project_key Project key. |
||
174 | * @param string $link_name Link name. |
||
175 | * @param integer $link_direction Link direction. |
||
176 | * @param array $component_ids Component IDs. |
||
177 | * |
||
178 | * @return string |
||
179 | * @throws \RuntimeException When failed to create an issue. |
||
180 | * @throws \InvalidArgumentException When link direction isn't valid. |
||
181 | */ |
||
182 | public function createLinkedIssue(Issue $issue, $project_key, $link_name, $link_direction, array $component_ids) |
||
245 | |||
246 | /** |
||
247 | * Determines if link was already processed. |
||
248 | * |
||
249 | * @param Issue $issue Issue. |
||
250 | * @param Issue $linked_issue Linked issue. |
||
251 | * |
||
252 | * @return boolean |
||
253 | */ |
||
254 | protected function isAlreadyProcessed(Issue $issue, Issue $linked_issue) |
||
258 | |||
259 | /** |
||
260 | * Determines if link is accepted. |
||
261 | * |
||
262 | * @param Issue $issue Issue. |
||
263 | * @param Issue $linked_issue Linked issue. |
||
264 | * |
||
265 | * @return boolean |
||
266 | */ |
||
267 | protected function isLinkAccepted(Issue $issue, Issue $linked_issue) |
||
271 | |||
272 | /** |
||
273 | * Returns ID of "Changelog Entry" issue type. |
||
274 | * |
||
275 | * @return integer |
||
276 | * @throws \LogicException When "Changelog Entry" issue type wasn't found. |
||
277 | */ |
||
278 | protected function getChangelogEntryIssueTypeId() |
||
297 | |||
298 | /** |
||
299 | * Returns custom field value. |
||
300 | * |
||
301 | * @param Issue $issue Issue. |
||
302 | * @param string $custom_field_id Custom field ID. |
||
303 | * |
||
304 | * @return mixed |
||
305 | */ |
||
306 | protected function getIssueCustomField(Issue $issue, $custom_field_id) |
||
316 | |||
317 | /** |
||
318 | * Returns issue status name. |
||
319 | * |
||
320 | * @param Issue $issue Issue. |
||
321 | * |
||
322 | * @return string |
||
323 | */ |
||
324 | public function getIssueStatusName(Issue $issue) |
||
330 | |||
331 | } |
||
332 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: