Bug #61483 [Opn->Sus]: When overriding DateTime::setTimezone() no type hint can be added.
| From: | cmb@php.net | Date: | Thu, 02 Jul 2015 16:26:55 +0000 |
| Subject: | Bug #61483 [Opn->Sus]: When overriding DateTime::setTimezone() no type hint can be added. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194071@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61483&edit=1
ID: 61483
Updated by: cmb@php.net
Reported by: me at rouvenwessling dot de
Summary: When overriding DateTime::setTimezone() no type hint
can be added.
-Status: Open
+Status: Suspended
Type: Bug
Package: Date/time related
Operating System: OS X 10.7
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
According to the discussion on internals@[1] I'm suspending this
ticket.
[1] <http://markmail.org/thread/usxbhcup2fmqyb2x>
Previous Comments:
------------------------------------------------------------------------
[2015-07-02 11:20:51] cmb@php.net
Related To: Bug #69977
------------------------------------------------------------------------
[2012-03-22 22:46:04] me at rouvenwessling dot de
Description:
------------
I'm testing a snapshot of the current Joomla Platform on PHP 5.4 (unsung Zend
Server CE) and just met an old friend. We're extending DateTime and would like to
type hint the $timezone argument in setTimezone().
Sample code:
class JDate extends DateTime
{
public function setTimezone(DateTimeZone $tz)
{
return parent::setTimezone($tz);
}
}
This causes the following E_STRICT error:
Strict Standards: Declaration of JDate::setTimezone() should be compatible with
DateTime::setTimezone($timezone)
The issue is not limited to PHP 5.4 but also occurs in older versions.
According to the documentation
(http://php.net/manual/en/datetime.settimezone.php) the only valid value is a
DateTimeZone object so it should be type hinted.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61483&edit=1