Standardizing allowed visibility modifiers on methods inside interfaces
Summary:
Overview: I've added error2047 (about visibility modifiers--protected, private, and public) to ensure consistency between the code accepted by the full fidelity parser and HHVM.
More information:
Prior to this diff, the full fidelity and original parsers would accept (otherwise-correct) methods with any visibility modifier inside of an interface. The full fidelity parser in particular would even allow omitting the modifier entirely. (The original parser would not--it threw the error "line 4, characters 3-10: Expected modifier (Parsing[1002])" on the code in test_visibility_modifier_errors.php.)
However, HHVM throws errors on methods declared 'private' or 'protected' inside of an interface. It throws the following errors on code in test_visibility_modifier_errors.php:
Fatal error: Access type for interface method I1::i3() must be omitted ... on line 6.
Fatal error: Access type for interface method I1::i3() must be omitted ... on line 7.
That said, HHVM does allow omitting the visibility modifier--it parses line 4 just fine.
By adding error2047, I've made sure that the full fidelity parser agrees with HHVM on which visibility modifiers are acceptable inside of interfaces.
(The Hack spec currently doesn't allow dropping the 'public', but Eric has submitted a spec issue asking them to relax that constraint.)
Reviewed By: ericlippert
Differential Revision:
D5352850
fbshipit-source-id:
6b539dac69e097207739823362fdcf7eca417af6