Change the third argument of callers from a boolean to an array
+ $connection->post("tweets", ["text" => $text], ['jsonPayload' => true]);
- $connection->post("tweets", ["text" => $text], true);$connection->upload( 
  'media/upload',
  ['media' => $file_path, 'media_type' => 'video/mp4'],
+   ['chunkedUpload' => true],
-   true
);