1 | <?php |
||
15 | class SendGrid |
||
16 | { |
||
17 | /** |
||
18 | * API base URL. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $apiUrl = 'https://api.sendgrid.com'; |
||
23 | |||
24 | /** |
||
25 | * API version. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $apiVersion = 'v3'; |
||
30 | |||
31 | /** |
||
32 | * Underlying HTTP client. |
||
33 | * |
||
34 | * @var \Http\Client\HttpClient |
||
35 | */ |
||
36 | protected $client; |
||
37 | |||
38 | /** |
||
39 | * Message factory. |
||
40 | * |
||
41 | * @var \Http\Message\MessageFactory |
||
42 | */ |
||
43 | protected $messageFactory; |
||
44 | |||
45 | /** |
||
46 | * Make a new ApiClient instance. |
||
47 | * |
||
48 | * If $client is null, a new HttpClient using $apiKey is instantiated. |
||
49 | * If $apiKey is null, SENDGRID_API_KEY environment variable is used. |
||
50 | * $apiKey is not used when $client is specified. |
||
51 | * |
||
52 | * @param null|string $apiKey |
||
53 | * @param null|\Http\Client\HttpClient $client |
||
54 | */ |
||
55 | public function __construct($apiKey = null, HttpClient $client = null) |
||
67 | |||
68 | /** |
||
69 | * Static constructor to get a ApiClient instance with a given HTTP client. |
||
70 | * |
||
71 | * @param \Http\Client\HttpClient $client |
||
72 | * @return self |
||
73 | */ |
||
74 | public static function newWithClient(HttpClient $client) |
||
78 | |||
79 | /** |
||
80 | * Get underlying HTTP client. |
||
81 | * |
||
82 | * @return \Http\Client\HttpClient |
||
83 | */ |
||
84 | public function getClient(): HttpClient |
||
88 | |||
89 | /** |
||
90 | * Make a "raw" HTTP request. |
||
91 | * |
||
92 | * JSON responses are automatically decoded to an array. |
||
93 | * |
||
94 | * @param string $method HTTP method |
||
95 | * @param string $url |
||
96 | * @return array|string |
||
97 | */ |
||
98 | public function requestRaw(string $method, string $url = '') |
||
117 | |||
118 | /** |
||
119 | * Make a request using a Request instance. |
||
120 | * |
||
121 | * @param Request $request |
||
122 | * @return Response|Response[] |
||
123 | */ |
||
124 | public function request(Request $request) |
||
133 | } |
||
134 |
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: