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); }
void TraitRequireStatement::onParseRecur(AnalysisResultConstPtr ar, ClassScopePtr scope) { if (!scope->isTrait()) { parseTimeFatal(Compiler::InvalidTraitStatement, "Only traits can require in class scope"); } ar->parseOnDemandByClass(toLower(m_required)); scope->addTraitRequirement(m_required, m_extends); }