Require non-absolute trait method refs to be unambiguous
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 3 Mar 2020 13:31:09 +0000 (14:31 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 10 Mar 2020 15:01:13 +0000 (16:01 +0100)
commitfff5771cccaca49565c90349320f3c06cbe19328
tree9e47e32c4f3f1da0211b5243fa9f0a503fd71090
parentd2b902f174b2e8c98bf5d4e257924a96b1323776
Require non-absolute trait method refs to be unambiguous

Currently, when writing something like

class X {
    use T1, T2 {
       func as otherFunc;
    }
    function func() {}
}

where both T1::func() and T2::func() exist, we will simply assume
that func refers to T1::func(). This is surprising, and it doesn't
really make sense that this particular method gets picked.

This commit validates that non-absolute method references are
unambiguous, i.e. refer to exactly one method. If there is
ambiguity, it is required to write T1::func as otherFunc or
similar.

Closes GH-5232.
UPGRADING
Zend/tests/bug62069.phpt [new file with mode: 0644]
Zend/tests/bug62069_2.phpt [new file with mode: 0644]
Zend/tests/traits/language011.phpt
Zend/zend_inheritance.c