Skip to content

Commit

Permalink
Initialize typed property "labels" so it can be accessed even if empty (
Browse files Browse the repository at this point in the history
#69)

* Update IssueField.php

Fix "Typed property JiraCloud\Issue\IssueField::$labels must not be accessed before initialization" when trying to access labels of a retrieved issue.

* Update IssueField.php

Remove whitespace in a blank line
  • Loading branch information
neskodi authored Oct 28, 2023
1 parent 0b12436 commit a1e6508
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Issue/IssueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class IssueField implements \JsonSerializable

public function __construct($updateIssue = false)
{
$this->labels = [];

if ($updateIssue !== true) {
$this->project = new \JiraCloud\Project\Project();

Expand Down

0 comments on commit a1e6508

Please sign in to comment.