code: public static function create($error, array $locations = [])
      {
          $formatted = ['message' => $error];
  
          if (! empty($locations)) {
              $formatted['locations'] = array_map(
                  static function ($loc) {
                      return $loc->toArray();
                  },
                  $locations
              );
          }
  
          return $formatted;
      }
docs: @deprecated as of v0.8.0
  
  @param string           $error
  @param SourceLocation[] $locations
  
  @return mixed[]