note 123543 added to class.datetimeimmutable
| From: | soullinker0googlemail@php.net | Date: | Thu, 24 Jan 2019 12:27:07 +0000 |
| Subject: | note 123543 added to class.datetimeimmutable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210109@lists.php.net to get a copy of this message | ||
class MyDateTime extends DateTimeImmutable
{
public function addDay(int $amount): MyDateTime
{
return $this->add(new DateInterval("P" . $amount . "D"));
}
}
addDay will return DateTimeImmutable not MyDateTime. It looks like there is no "return
static;"
i wish i would be
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.194 (proxied: 5.189.103.198)
----
Manual Page -- http://php.net/manual/en/class.datetimeimmutable.php
Edit -- https://master.php.net/note/edit/123543
Del: integrated -- https://master.php.net/note/delete/123543/integrated
Del: useless -- https://master.php.net/note/delete/123543/useless
Del: bad code -- https://master.php.net/note/delete/123543/bad+code
Del: spam -- https://master.php.net/note/delete/123543/spam
Del: non-english -- https://master.php.net/note/delete/123543/non-english
Del: in docs -- https://master.php.net/note/delete/123543/in+docs
Del: other reasons-- https://master.php.net/note/delete/123543
Reject -- https://master.php.net/note/reject/123543
Search -- https://master.php.net/manage/user-notes.php