throwExpression() final public static method

final public static throwExpression ( Expression $exception ) : ThrowExpression
$exception Expression
return ThrowExpression
Ejemplo n.º 1
0
 public function expressions()
 {
     return [[O\Expression::arrayExpression([])], [O\Expression::arrayItem(null, O\Expression::value(0), false)], [O\Expression::assign(O\Expression::value(0), O\Operators\Assignment::EQUAL, O\Expression::value(0))], [O\Expression::binaryOperation(O\Expression::value(0), O\Operators\Binary::ADDITION, O\Expression::value(0))], [O\Expression::unaryOperation(O\Operators\Unary::PLUS, O\Expression::value(0))], [O\Expression::cast(O\Operators\Cast::STRING, O\Expression::value(0))], [O\Expression::closure(false, false, [], [], [])], [O\Expression::closureUsedVariable('var')], [O\Expression::emptyExpression(O\Expression::value(0))], [O\Expression::field(O\Expression::value(0), O\Expression::value(0))], [O\Expression::functionCall(O\Expression::value(0))], [O\Expression::index(O\Expression::value(0), O\Expression::value(0))], [O\Expression::invocation(O\Expression::value(0))], [O\Expression::issetExpression([O\Expression::value(0)])], [O\Expression::unsetExpression([O\Expression::value(0)])], [O\Expression::methodCall(O\Expression::value(0), O\Expression::value(0))], [O\Expression::newExpression(O\Expression::value(0))], [O\Expression::parameter('')], [O\Expression::argument(O\Expression::value(0))], [O\Expression::returnExpression()], [O\Expression::staticMethodCall(O\Expression::value(0), O\Expression::value(0))], [O\Expression::staticField(O\Expression::value(0), O\Expression::value(0))], [O\Expression::ternary(O\Expression::value(0), null, O\Expression::value(0))], [O\Expression::throwExpression(O\Expression::value(0))], [O\Expression::value(0)], [O\Expression::variable(O\Expression::value(0))], [O\Expression::constant('foo')], [O\Expression::classConstant(O\Expression::value(0), 'foo')]];
 }
Ejemplo n.º 2
0
 private function parseStatementNode(Node\Stmt $node)
 {
     switch (true) {
         case $node instanceof Node\Stmt\Return_:
             return Expression::returnExpression($node->expr !== null ? $this->parseNode($node->expr) : null);
         case $node instanceof Node\Stmt\Throw_:
             return Expression::throwExpression($this->parseNode($node->expr));
         case $node instanceof Node\Stmt\Unset_:
             return Expression::unsetExpression($this->parseNodes($node->vars));
         default:
             $this->verifyNotControlStructure($node);
             throw new ASTException('Cannot parse AST with unknown statement node: %s', get_class($node));
     }
 }
Ejemplo n.º 3
0
 /**
  * @dataProvider parsers
  */
 public function testThrowNewExceptionStatement()
 {
     $this->assertParsedAs(function () {
         throw null;
     }, [O\Expression::throwExpression(O\Expression::constant('null'))]);
 }