Skip to content

Commit

Permalink
IssueService: fix php warning regaring invalid argument for foreach (#…
Browse files Browse the repository at this point in the history
…430)

* IssueService: fix php warning regaring invalid argument for foreach

* fix
  • Loading branch information
staabm authored May 18, 2022
1 parent 91c754e commit 05d583f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1154,12 +1154,16 @@ public function getIssueSecuritySchemes($securityId)
public function updateLabels($issueIdOrKey, $addLablesParam, $removeLabelsParam, $notifyUsers = true)
{
$labels = [];
foreach ($addLablesParam as $a) {
array_push($labels, ['add' => $a]);
if ($addLablesParam !== null) {
foreach ($addLablesParam as $a) {
array_push($labels, ['add' => $a]);
}
}

foreach ($removeLabelsParam as $r) {
array_push($labels, ['remove' => $r]);
if ($removeLabelsParam !== null) {
foreach ($removeLabelsParam as $r) {
array_push($labels, ['remove' => $r]);
}
}

$postData = json_encode([
Expand Down Expand Up @@ -1192,12 +1196,16 @@ public function updateLabels($issueIdOrKey, $addLablesParam, $removeLabelsParam,
public function updateFixVersions($issueIdOrKey, $addFixVersionsParam, $removeFixVersionsParam, $notifyUsers = true)
{
$fixVersions = [];
foreach ($addFixVersionsParam as $a) {
array_push($fixVersions, ['add' => ['name' => $a]]);
if ($addFixVersionsParam !== null) {
foreach ($addFixVersionsParam as $a) {
array_push($fixVersions, ['add' => ['name' => $a]]);
}
}

foreach ($removeFixVersionsParam as $r) {
array_push($fixVersions, ['remove' => ['name' => $r]]);
if ($removeFixVersionsParam !== null) {
foreach ($removeFixVersionsParam as $r) {
array_push($fixVersions, ['remove' => ['name' => $r]]);
}
}

$postData = json_encode([
Expand Down

0 comments on commit 05d583f

Please sign in to comment.