Storm\Drivers\Fluent\Object\Functional\IAST::HasReturnNode PHP Метод

HasReturnNode() публичный Метод

public HasReturnNode ( )
    public function HasReturnNode();

Usage Example

Пример #1
0
 private function ParseReturnExpression(Functional\IAST $AST)
 {
     if (!$AST->HasEntityMap() || $AST->GetEntityMap()->GetEntityType() !== $this->GetEntityType()) {
         throw new \Storm\Core\Object\TypeMismatchException('The supplied AST must be of entity type %s: %s given', $this->GetEntityType(), $AST->HasEntityMap() ? $AST->GetEntityMap()->GetEntityType() : 'null');
     }
     if (!$AST->HasReturnNode()) {
         throw new FluentException('The supplied closure must contain a valid return statement');
     }
     $ReturnNodes = $AST->GetReturnNodes();
     if (count($ReturnNodes) > 1) {
         throw new FluentException('The supplied closure must contain a single return statement');
     }
     $AST->SetPropertyMode(Functional\IAST::PropertiesAreGetters);
     return $AST->ParseNode($ReturnNodes[0]);
 }