|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2015-07-02 11:20 UTC] cmb@php.net
 
-Status: Open
+Status: Verified
  [2015-07-02 11:20 UTC] cmb@php.net
  [2015-07-02 11:50 UTC] phofstetter at sensational dot ch
  [2015-07-02 12:11 UTC] phofstetter at sensational dot ch
  [2015-07-02 12:36 UTC] cmb@php.net
  [2015-07-02 16:26 UTC] cmb@php.net
 
-Status: Verified
+Status: Suspended
  [2015-07-02 16:26 UTC] cmb@php.net
  [2018-03-29 17:18 UTC] cmb@php.net
 
-Package: *General Issues
+Package: Date/time related
 | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 17:00:02 2025 UTC | 
Description: ------------ When you subclass DateTime, PHP insists on there being no type hint present for `add()` and `sub()`. If you type-hint them to `DateInterval`, php throws a warning about the signature not matching the parent, even though the manual (and reality agrees) says that the argument is a DateTimeInterval. While I would personally love for this warning to be turnoaffable or at least not be a warning but a notice, it certainy shouldn't warn for correct usage. As it stands now, code that was using type hints issues warnings until the type hints are removed, even though DateTime::add() also issues a warning if you pass anything but a DateInterval as an argument. Test script: --------------- <?php class Foo extends DateTime { function add(DateInterval $interval){ parent::add($interval); } } Expected result: ---------------- no output. No warning Actual result: -------------- PHP Warning: Declaration of Foo::add() should be compatible with DateTime::add($interval) in foo.php on line 5