Exemplo n.º 1
0
void ClassRequireStatement::onParseRecur(AnalysisResultConstPtr ar,
                                         FileScopeRawPtr fs,
                                         ClassScopePtr scope) {
  if (!scope->isTrait() && !scope->isInterface()) {
    parseTimeFatal(fs,
                   Compiler::InvalidTraitStatement,
                   "Only traits and interfaces may use 'require' in class scope");
  }
  if (scope->isInterface() && !m_extends) {
    parseTimeFatal(
      fs,
      Compiler::InvalidTraitStatement,
      "'require implements' may not be used in interface scope"
      "; instead, use interface inheritance");
  }

  ar->parseOnDemandByClass(toLower(m_required));
  scope->addClassRequirement(m_required, m_extends);
}