Bug #77562 [NEW]: Inheritance signature checking for void return type
| From: | danack@php.net | Date: | Mon, 04 Feb 2019 06:50:20 +0000 |
| Subject: | Bug #77562 [NEW]: Inheritance signature checking for void return type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219353@lists.php.net to get a copy of this message | ||
From: danack
Operating system:
PHP version: 7.2.14
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Inheritance signature checking for void return type
Description:
------------
From PHP 7.2 dropping the return type for methods in child classes is
meant to be allowed on method signature checks:
https://wiki.php.net/rfc/parameter-no-type-variance
Test script:
---------------
class Foo{
function method (): void {}
}
// This should work in php 7.2+
class Bar extends Foo {
function method () {}
}
Expected result:
----------------
No error.
Actual result:
--------------
Fatal error: Declaration of Bar::method() must be compatible with
Foo::method(): void in /in/3E70o on line 11
--
Edit bug report at https://bugs.php.net/bug.php?id=77562&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77562&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77562&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77562&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77562&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77562&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77562&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77562&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77562&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77562&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77562&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77562&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77562&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77562&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77562&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77562&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77562&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77562&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77562&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77562&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77562&r=mysqlcfg