Skip to content

Invalid trait insteadof list #18223

Open
Open
@iluuu1994

Description

@iluuu1994

Description

The following code:

<?php

trait A {
    public function test() {
        return 'A';
    }
}

trait B {
    public function test() {
        return 'B';
    }
}

class C {
    use A, B {
        A::test insteadof B;
        B::test insteadof A;
    }
}

$c = new C();
var_dump($c->test());

Resulted in this output:

Fatal error: Uncaught Error: Call to undefined method C::test()

But I expected this output instead:

Some trait-resolution-time error

PHP Version

PHP-5.4+

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions