interface requirements : new lang feature [1/2]
Summary: This is the logical extension of trait requirements necessary
to capture the "marker interface" pattern, wherein an interface is
implicitly tied to a type hierarachy as with the following code:
class Super {
...
if ($this instanceof IMarker) {
$this->methodOfMarker();
}
...
}
...
function marked(IMarker $inst) {
$inst->methodOfSuper();
}
...
interface IMarker {
...
// new syntax to indicate that IMarker is only for children of Super
require extends Super;
...
}
This diff ensures that the syntax is supported in the parser, but
does not enforce the requirements (left to next diff).
Reviewed By: @paroski
Differential Revision:
D1387181