Bug #75449 [NEW]: Ignored return type for abstract methods, defined in traits
From: alex dot rill at yandex dot ru
Operating system: Windows
PHP version: 7.1.11
Package: Class/Object related
Bug Type: Bug
Bug description:Ignored return type for abstract methods, defined in traits
Description:
------------
Dont speak english. All in example code.
---
From manual page: http://www.php.net/language.oop5.traits
---
Test script:
---------------
<?php
trait T {
abstract static function values(): array;
}
class B {
use T;
static function values() {
return 'Worked!'; // string, not array
}
}
echo B::values(); // print: Worked!
abstract class B {
use T;
}
class C extends B {
static function values() {
return 'Don\'t worked';
}
}
echo C::values(); // Fatal Error: Class D contains 1 abstract method and
must therefore be declared abstract or implement the remaining methods
(C::values)
?>
Online example:
http://sandbox.onlinephpfunctions.com/code/7b26e7237abcf97d15aac6a0868c084241bf8d0c
--
Edit bug report at https://bugs.php.net/bug.php?id=75449&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75449&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75449&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75449&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75449&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75449&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75449&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75449&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75449&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75449&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75449&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75449&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75449&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75449&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75449&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75449&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75449&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75449&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75449&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75449&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75449&r=mysqlcfg
Thread (6 messages)
- alex dot rill at yandex dot ru
- saintatgod at gmail dot comBug #75449 [Com]: Ignored return type for abstract methods, defined in traits
- saintatgod at gmail dot comBug #75449 [Com]: Ignored return type for abstract methods, defined in traits
- pmmaga@php.netBug #75449 [Opn->Nab]: Ignored return type for abstract methods, defined in traits
- pmmaga@php.netBug #75449 [Nab->Opn]: Ignored return type for abstract methods, defined in traits
- eric at ericstern dot comBug #75449 [Com]: Ignored return type for abstract methods, defined in traits