The return type could not be reliably inferred; please add a @return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a @return
annotation as described here.
Loading history...
19
{
20
switch (true) {
21
case is_string($this->deleted_at):
22
case is_object($this->deleted_at) && get_class($this->deleted_at) !== 'DateTime':
23
throw new \Exception("deleted_at is not a datetime", 400);
24
case $this->deleted_at === null:
25
case $format === null:
26
return $this->deleted_at;
27
default:
28
return $this->deleted_at->format($format);
29
}
30
}
31
32
/**
33
* Setter
34
*/
35
public function setDeletedAt($datetime)
36
{
37
switch (true) {
38
case is_object($datetime) && get_class($datetime) !== 'DateTime':
39
case is_string($datetime) && !preg_match("#^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$#", trim($datetime)):
40
throw new \Exception("bad deleted_at provided", 400);
41
default:
42
$this->deleted_at = (is_object($datetime)) ? $datetime : new \DateTime($datetime);
43
}
44
45
return $this;
46
}
47
48
/**
49
* @PreRemove
50
*/
51
public function canNotDelete()
52
{
53
throw new \Exception("Cannot delete " . get_class($this));
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.