1 | <?php |
||
16 | class SendGrid |
||
17 | { |
||
18 | /** |
||
19 | * API base URL. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $apiUrl = 'https://api.sendgrid.com'; |
||
24 | |||
25 | /** |
||
26 | * API version. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $apiVersion = 'v3'; |
||
31 | |||
32 | /** |
||
33 | * Underlying HTTP client. |
||
34 | * |
||
35 | * @var \Http\Client\HttpClient |
||
36 | */ |
||
37 | protected $client; |
||
38 | |||
39 | /** |
||
40 | * Message factory. |
||
41 | * |
||
42 | * @var \Http\Message\MessageFactory |
||
43 | */ |
||
44 | protected $messageFactory; |
||
45 | |||
46 | /** |
||
47 | * Make a new ApiClient instance. |
||
48 | * |
||
49 | * If $client is null, a new HttpClient using $apiKey is instantiated. |
||
50 | * If $apiKey is null, SENDGRID_API_KEY environment variable is used. |
||
51 | * $apiKey is not used when $client is specified. |
||
52 | * |
||
53 | * @param null|string $apiKey |
||
54 | * @param null|\Http\Client\HttpClient $client |
||
55 | */ |
||
56 | public function __construct($apiKey = null, HttpClient $client = null) |
||
68 | |||
69 | /** |
||
70 | * Static constructor to get a ApiClient instance with a given HTTP client. |
||
71 | * |
||
72 | * @param \Http\Client\HttpClient $client |
||
73 | * @return self |
||
74 | */ |
||
75 | public static function newWithClient(HttpClient $client) |
||
79 | |||
80 | /** |
||
81 | * Set the underlying HTTP client. |
||
82 | * |
||
83 | * @param \Http\Client\HttpClient $client |
||
84 | * @return self |
||
85 | */ |
||
86 | public function withClient(HttpClient $client): self |
||
92 | |||
93 | /** |
||
94 | * Get underlying HTTP client. |
||
95 | * |
||
96 | * @return \Http\Client\HttpClient |
||
97 | */ |
||
98 | public function getClient(): HttpClient |
||
102 | |||
103 | /** |
||
104 | * Make a "raw" HTTP request. |
||
105 | * |
||
106 | * JSON responses are automatically decoded to an array. |
||
107 | * |
||
108 | * @param string $method HTTP method |
||
109 | * @param string $url |
||
110 | * @return string|array|\Illuminate\Support\Collection |
||
111 | */ |
||
112 | public function requestRaw(string $method, string $url = '') |
||
131 | |||
132 | /** |
||
133 | * Make a request using a Request instance. |
||
134 | * |
||
135 | * @param Request $request |
||
136 | * @return Response|Response[] |
||
137 | */ |
||
138 | public function request(Request $request) |
||
147 | } |
||
148 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: