src/Converter/Operator.php
public function operate( Expression $left, Expression $right ) {
		$typeSpec = self::$opTypes[$this->name];

		$leftType = self::$typeSpecMap[$typeSpec[0]];
		$rightType = self::$typeSpecMap[$typeSpec[1]];
		$resultType = self::$typeSpecMap[$typeSpec[2]];

		$start = min( $this->pos, $left->pos, $right->pos );
		$end = max( $this->end, $left->end, $right->end );
		$length = $end - $start;

		$newExpr = new Expression( $this->parser, $resultType,
			"{$left->rpn} {$right->rpn} {$this->name}",
			$start, $length );

		if ( !$left->isType( $leftType ) ) {
			$newExpr->error( "invalid type for left operand: expected $leftType, got {$left->type}" );
		}

		if ( !$right->isType( $rightType ) ) {
			$newExpr->error( "invalid type for right operand: expected $rightType, got {$right->type}" );
		}

		return $newExpr;
	}
public function operate( Expression $left, Expression $right ) {
		$typeSpec = self::$opTypes[$this->name];

		$leftType = self::$typeSpecMap[$typeSpec[0]];
		$rightType = self::$typeSpecMap[$typeSpec[1]];
		$resultType = self::$typeSpecMap[$typeSpec[2]];

		$start = min( $this->pos, $left->pos, $right->pos );
		$end = max( $this->end, $left->end, $right->end );
		$length = $end - $start;

		$newExpr = new Expression( $this->parser, $resultType,
			"{$left->rpn} {$right->rpn} {$this->name}",
			$start, $length );

		if ( !$left->isType( $leftType ) ) {
			$newExpr->error( "invalid type for left operand: expected $leftType, got {$left->type}" );
		}

		if ( !$right->isType( $rightType ) ) {
			$newExpr->error( "invalid type for right operand: expected $rightType, got {$right->type}" );
		}

		return $newExpr;
	}
public function operate ( Expression $ left , Expression $ right ) { $ typeSpec = self :: $ opTypes [ $ this -> name ] ; $ leftType = self :: $ typeSpecMap [ $ typeSpec [ 0 ] ] ; $ rightType = self :: $ typeSpecMap [ $ typeSpec [ 1 ] ] ; $ resultType = self :: $ typeSpecMap [ $ typeSpec [ 2 ] ] ; $ start = min ( $ this -> pos , $ left -> pos , $ right -> pos ) ; $ end = max ( $ this -> end , $ left -> end , $ right -> end ) ; $ length = $ end - $ start ; $ newExpr = new Expression ( $ this -> parser , $ resultType , "{$left->rpn} {$right->rpn} {$this->name}" , $ start , $ length ) ; if ( ! $ left -> isType ( $ leftType ) ) { $ newExpr -> error ( "invalid type for left operand: expected $leftType, got {$left->type}" ) ; } if ( ! $ right -> isType ( $ rightType ) ) { $ newExpr -> error ( "invalid type for right operand: expected $rightType, got {$right->type}" ) ; } return $ newExpr ; }
Compute the operation

@param Expression $left The left part of the expression
@param Expression $right The right part of the expression
@return Expression The result of the operation
Compute the operation