php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69084 Unclear error message when not implementing a renamed abstract trait function
Submitted: 2015-02-19 21:00 UTC Modified: -
From: fredemmott@php.net Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.6.5 OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-02-19 21:00 UTC] fredemmott@php.net
Description:
------------
It reports that the non-renamed function has not been implemented, even when it has. eg http://3v4l.org/vDEP9#v5411

Test script:
---------------
<?php

trait Foo {
    abstract public function doStuff();
    
    public function main() {
        $this->doStuff();
    }
}

class Bar {
    use Foo {
        Foo::doStuff as doOtherStuff;
    }
    
    public function doStuff() {
        var_dump(__FUNCTION__);
    }
}

$b = new Bar();
$b->main();

Expected result:
----------------
Complaint about doOtherStuff not being implemented.

Actual result:
--------------
Fatal error: Class Bar contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Bar::doStuff) in /in/vDEP9 on line 19

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 28 19:01:26 2020 UTC