php/php-langspec

Trait insteadof clause should accept a list of trait names instead of a single name

TysonAndre opened this issue · 2 comments

The below code is syntactically valid, and needed to indicate which implementation of foo to inherit

<?php 
class C{
    use T1,T2,T3{T1::foo insteadof T2,T3;}
}

Currently, the specification says that it accepts a single name. https://github.com/php/php-langspec/blob/master/spec/16-traits.md#trait-uses

trait-select-insteadof-clause:
   name   insteadof   name

Should that be name 'insteadof' trait-name-list? Also, I'm not familiar with this project or why it's name instead of qualified-name

Noticed when working on microsoft/tolerant-php-parser#190

nikic commented

The RHS should indeed be trait-name-list. The LHS should be qualified-name '::' name. Would you like to submit a PR?

I created #218 for this