finish annotation supprt
This commit is contained in:
@@ -24,6 +24,15 @@ class Annotation
|
||||
*/
|
||||
private $entry;
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function __construct($description = null)
|
||||
{
|
||||
$this->entry = new Carbon(); // todo https://bug.tasktools.org/browse/TW-1780
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -111,7 +111,7 @@ class Task
|
||||
*
|
||||
* @JMS\Type("array<DavidBadura\Taskwarrior\Annotation>")
|
||||
*/
|
||||
private $annotations;
|
||||
private $annotations = [];
|
||||
|
||||
/**
|
||||
* @var Carbon
|
||||
@@ -364,7 +364,7 @@ class Task
|
||||
*/
|
||||
public function getAnnotations()
|
||||
{
|
||||
return $this->annotations;
|
||||
return (array)$this->annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,8 +394,9 @@ class Task
|
||||
*/
|
||||
public function removeAnnotation(Annotation $annotation)
|
||||
{
|
||||
if ($key = array_search($annotation, $this->annotations)) {
|
||||
if (false !== $key = array_search($annotation, $this->annotations)) {
|
||||
unset($this->annotations[$key]);
|
||||
$this->annotations = array_values($this->annotations);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user