Req #78401 [Opn->Fbk]: DateTime::modify signature change

From: Date: Sun, 11 Aug 2019 20:42:46 +0000
Subject: Req #78401 [Opn->Fbk]: DateTime::modify signature change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222185@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78401&edit=1 ID: 78401 Updated by: nikic@php.net Reported by: kylekatarnls at gmail dot com Summary: DateTime::modify signature change -Status: Open +Status: Feedback Type: Feature/Change Request Package: Compile Failure Operating System: Linux PHP Version: Next Major Version Block user comment: N Private report: N New Comment: I can't reproduce this. Previous Comments: ------------------------------------------------------------------------ [2019-08-11 20:06:30] kylekatarnls at gmail dot com Description: ------------ My last Travis-CI test failed (while same code worked until there) for PHP 8.0.0-dev with the following message: Declaration of DateTime::modify(string $modify) must be compatible with I::modify($modify) Test script: --------------- interface I extends DateTimeInterface { modify($modify); } class A extends DateTime implements I { modify($modify) {} } Expected result: ---------------- I would expect my interface to be compatible with DateTime since it's covariant. I accept more types but string is included so it should pass as there is no reason to forbid this extension. Then I would be compatible with both PHP 7 and 8 but if I change the signature to a the string typing, it will fail on PHP 7. Actual result: -------------- Declaration of DateTime::modify(string $modify) must be compatible with I::modify($modify) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78401&edit=1

« previous php.bugs (#222185) next »