original_string: protected function _castToExpression($value, $type)
      {
          if (empty($type)) {
              return $value;
          }
  
          $baseType = str_replace('[]', '', $type);
          $converter = Type::build($baseType);
  
          if (!$converter instanceof ExpressionTypeInterface) {
              return $value;
          }
  
          $multi = $type !== $baseType;
  
          if ($multi) {
              return array_map([$converter, 'toExpression'], $value);
          }
  
          return $converter->toExpression($value);
      }
code: protected function _castToExpression($value, $type)
      {
          if (empty($type)) {
              return $value;
          }
  
          $baseType = str_replace('[]', '', $type);
          $converter = Type::build($baseType);
  
          if (!$converter instanceof ExpressionTypeInterface) {
              return $value;
          }
  
          $multi = $type !== $baseType;
  
          if ($multi) {
              return array_map([$converter, 'toExpression'], $value);
          }
  
          return $converter->toExpression($value);
      }
code_tokens: protected function _castToExpression ( $ value , $ type ) { if ( empty ( $ type ) ) { return $ value ; } $ baseType = str_replace ( '[]' , '' , $ type ) ; $ converter = Type :: build ( $ baseType ) ; if ( ! $ converter instanceof ExpressionTypeInterface ) { return $ value ; } $ multi = $ type !== $ baseType ; if ( $ multi ) { return array_map ( [ $ converter , 'toExpression' ] , $ value ) ; } return $ converter -> toExpression ( $ value ) ; }
docstring: Conditionally converts the passed value to an ExpressionInterface object
  if the type class implements the ExpressionTypeInterface. Otherwise,
  returns the value unmodified.
  
  @param mixed $value The value to converto to ExpressionInterface
  @param string $type The type name
  @return mixed
docstring_tokens: Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface . Otherwise returns the value unmodified .