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: 2020-03-03 11:11 UTC
From: fredemmott@php.net Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.6.5 OS: n/a
Private report: No CVE-ID: None
 [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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-03 11:11 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC