In this branch, the function will implicitly return null which is incompatible with the type-hinted return Scrumban\Model\EstimableInterface. Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type.
Let?s take a look at an example:
interfaceReturnsInt{publicfunctionreturnsIntHinted():int;}classMyClassimplementsReturnsInt{publicfunctionreturnsIntHinted():int{if(foo()){return123;}// here: null is implicitly returned}}
Loading history...
78
}
79
80
public function getSpentTime(): float
81
{
82
return $this->spentTime;
83
}
84
85
public function setCreatedAt(\DateTime $createdAt): self
86
{
87
$this->createdAt = $createdAt;
88
89
return $this;
90
}
91
92
public function getCreatedAt(): \DateTime
93
{
94
return $this->createdAt;
95
}
96
97
public function setUpdatedAt(\DateTime $updatedAt): self
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: