@@ -187,13 +187,13 @@ protected function clearLocalCaches() {
187
187
/**
188
188
* Get fields definitions.
189
189
*
190
- * @return array
190
+ * @return array|null
191
191
*/
192
192
public function getFields () {
193
193
// Fetch fields when the method is called for the first time.
194
194
if ($ this ->fields === null ) {
195
195
$ fields = [];
196
- $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/field ' , [], true );
196
+ $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/field ' );
197
197
198
198
/* set hash key as custom field id */
199
199
foreach ($ result as $ field ) {
@@ -254,7 +254,7 @@ public function deleteIssue($issueKey, bool $deleteSubtasks = true, array $param
254
254
/**
255
255
* Gets attachments meta information.
256
256
*
257
- * @return array
257
+ * @return array|false
258
258
*/
259
259
public function getAttachmentsMetaInformation () {
260
260
return $ this ->api (static ::REQUEST_GET , '/rest/api/2/attachment/meta ' );
@@ -268,7 +268,7 @@ public function getAttachmentsMetaInformation() {
268
268
* @return array|false
269
269
*/
270
270
public function getAttachment ($ attachment_id ) {
271
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/attachment/%s ' , $ attachment_id ), [], true );
271
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/attachment/%s ' , $ attachment_id ));
272
272
}
273
273
274
274
/**
@@ -283,37 +283,37 @@ public function getProjects() {
283
283
/**
284
284
* Returns one project.
285
285
*
286
- * @param string $project_key Project key.
286
+ * @param string $projectKey Project ID or key.
287
287
*
288
288
* @return array|false
289
289
*/
290
- public function getProject ($ project_key ) {
291
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s ' , $ project_key ), [], true );
290
+ public function getProject ($ projectKey ) {
291
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s ' , $ projectKey ) );
292
292
}
293
293
294
294
/**
295
295
* Returns all roles of a project.
296
296
*
297
- * @param string $project_key Project key.
297
+ * @param string $projectKey Project ID or key.
298
298
*
299
299
* @return array|false
300
300
*/
301
- public function getRoles ($ project_key ) {
302
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/role ' , $ project_key ), [], true );
301
+ public function getRoles ($ projectKey ) {
302
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/role ' , $ projectKey ) );
303
303
}
304
304
305
305
/**
306
306
* Returns role details.
307
307
*
308
- * @param string $project_key Project key.
309
- * @param string $role_id Role ID.
308
+ * @param string $projectKey Project key.
309
+ * @param string $roleId Role ID.
310
310
*
311
311
* @return array|false
312
312
*/
313
- public function getRoleDetails ($ project_key , $ role_id ) {
313
+ public function getRoleDetails ($ projectKey , $ roleId ) {
314
314
return $ this ->api (
315
315
static ::REQUEST_GET ,
316
- sprintf ('/rest/api/2/project/%s/role/%s ' , $ project_key , $ role_id ),
316
+ sprintf ('/rest/api/2/project/%s/role/%s ' , $ projectKey , $ roleId ),
317
317
[],
318
318
true ,
319
319
);
@@ -322,7 +322,7 @@ public function getRoleDetails($project_key, $role_id) {
322
322
/**
323
323
* Returns the meta data for creating issues.
324
324
* This includes the available projects, issue types
325
- * and fields, including field types and whether or not those fields are required.
325
+ * and fields, including field types and whether those fields are required.
326
326
* Projects will not be returned if the user does not have permission to create issues in that project.
327
327
* Fields will only be returned if "projects.issuetypes.fields" is added as expand parameter.
328
328
*
@@ -472,7 +472,7 @@ public function transition($issueKey, array $params = []) {
472
472
*/
473
473
public function getIssueTypes () {
474
474
$ result = [];
475
- $ types = $ this ->api (static ::REQUEST_GET , '/rest/api/2/issuetype ' , [], true );
475
+ $ types = $ this ->api (static ::REQUEST_GET , '/rest/api/2/issuetype ' );
476
476
477
477
foreach ($ types as $ type ) {
478
478
$ result [] = new IssueType ($ type );
@@ -489,7 +489,7 @@ public function getIssueTypes() {
489
489
* @return array|false
490
490
*/
491
491
public function getVersions ($ project_key ) {
492
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/versions ' , $ project_key ), [], true );
492
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/versions ' , $ project_key ));
493
493
}
494
494
495
495
/**
@@ -521,13 +521,13 @@ public function findVersionByName($project_key, $name) {
521
521
/**
522
522
* Get available priorities.
523
523
*
524
- * @return array
524
+ * @return array|false
525
525
*/
526
526
public function getPriorities () {
527
527
// Fetch priorities when the method is called for the first time.
528
528
if ($ this ->priorities === null ) {
529
529
$ priorities = [];
530
- $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/priority ' , [], true );
530
+ $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/priority ' );
531
531
532
532
/* set hash key as custom field id */
533
533
foreach ($ result as $ priority ) {
@@ -549,7 +549,7 @@ public function getStatuses() {
549
549
// Fetch statuses when the method is called for the first time.
550
550
if ($ this ->statuses === null ) {
551
551
$ statuses = [];
552
- $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/status ' , [], true );
552
+ $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/status ' );
553
553
554
554
/* set hash key as custom field id */
555
555
foreach ($ result as $ status ) {
@@ -643,7 +643,7 @@ public function createVersion($projectKey, $version, array $options = []) {
643
643
* @param int $version_id Version ID.
644
644
* @param array $params Key->Value list to update the version with.
645
645
*
646
- * @return false
646
+ * @return array| false
647
647
*/
648
648
public function updateVersion ($ version_id , array $ params = []) {
649
649
return $ this ->api (static ::REQUEST_PUT , sprintf ('/rest/api/2/version/%d ' , $ version_id ), $ params );
@@ -690,7 +690,7 @@ public function createAttachment($issueKey, $filename, $name = null) {
690
690
static ::REQUEST_POST ,
691
691
sprintf ('/rest/api/2/issue/%s/attachments ' , $ issueKey ),
692
692
$ options ,
693
- false ,
693
+ true ,
694
694
true ,
695
695
);
696
696
}
@@ -742,7 +742,7 @@ public function api(
742
742
$ method ,
743
743
$ url ,
744
744
$ data = [],
745
- $ return_as_array = false ,
745
+ $ return_as_array = true ,
746
746
$ is_file = false ,
747
747
$ debug = false
748
748
) {
@@ -884,33 +884,33 @@ public function closeIssue($issueKey) {
884
884
*
885
885
* @param string $project_key Project key.
886
886
*
887
- * @return array
887
+ * @return array|false
888
888
*/
889
889
public function getProjectComponents ($ project_key ) {
890
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/components ' , $ project_key ), [], true );
890
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/components ' , $ project_key ));
891
891
}
892
892
893
893
/**
894
894
* Get all issue types with valid status values for a project.
895
895
*
896
896
* @param string $project_key Project key.
897
897
*
898
- * @return array
898
+ * @return array|false
899
899
*/
900
900
public function getProjectIssueTypes ($ project_key ) {
901
- return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/statuses ' , $ project_key ), [], true );
901
+ return $ this ->api (static ::REQUEST_GET , sprintf ('/rest/api/2/project/%s/statuses ' , $ project_key ));
902
902
}
903
903
904
904
/**
905
905
* Returns a list of all resolutions.
906
906
*
907
- * @return array
907
+ * @return array|false
908
908
*/
909
909
public function getResolutions () {
910
910
// Fetch resolutions when the method is called for the first time.
911
911
if ($ this ->resolutions === null ) {
912
912
$ resolutions = [];
913
- $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/resolution ' , [], true );
913
+ $ result = $ this ->api (static ::REQUEST_GET , '/rest/api/2/resolution ' );
914
914
915
915
foreach ($ result as $ resolution ) {
916
916
$ resolutions [$ resolution ['id ' ]] = $ resolution ;
0 commit comments