|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-04-10 14:49 UTC] aharvey@php.net
-Package: date_time
+Package: Date/time related
[2015-07-02 16:26 UTC] cmb@php.net
-Status: Open
+Status: Suspended
[2015-07-02 16:26 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 06:00:02 2025 UTC |
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.