title: Guzzle: Magic request methods require a URI and optional options array
body: <p>I'm using <a href="https://github.com/golincode/sharepoint-oauth-app-client" rel="nofollow noreferrer">https://github.com/golincode/sharepoint-oauth-app-client</a> which is outdated and uses Guzzle version 5. My Symfony application uses Guzzle 6. I'm trying to update the outdated code to work with Guzzle 6 but I encounter the following error:</p>
  
  <pre><code>Magic request methods require a URI and optional options array
  </code></pre>
  
  <p>The code in the controller.</p>
  
  <pre><code>$settings = [
              'site' =&gt; [
                  'resource'  =&gt; '00000000-0000-ffff-0000-000000000000/example.sharepoint.com@09g7c3b0-f0d4-416d-39a7-09671ab91f64',
                  'client_id' =&gt; '52848cad-bc13-4d69-a371-30deff17bb4d/example.com@09g7c3b0-f0d4-416d-39a7-09671ab91f64',
                  'secret'    =&gt; 'YzcZQ7N4lTeK5COin/nmNRG5kkL35gAW1scrum5mXVgE=',
              ]
          ];
          // create a SharePoint Site instance
          $site = SPSite::create('https://example.sharepoint.com/sites/mySite/', $settings);
  </code></pre>
  
  <p>SPSite.php Create function</p>
  
  <pre><code>public static function create($url, array $settings = [])
  {
      // ensure we have a trailing slash
      if (is_string($url)) {
          $url = sprintf('%s/', rtrim($url, '/'));
      }
  
      $settings = array_replace_recursive($settings, [
          'site' =&gt; [], // SharePoint Site configuration
          'http' =&gt; [   // Guzzle HTTP Client configuration
              'base_url' =&gt; $url,
          ],
      ]);
  
      $http = new Client($settings['http']);
  
      return new static($http, $settings['site']);
  }
  </code></pre>
  
  <p>Client.php call function</p>
  
  <pre><code>public function __call($method, $args)
  {
      if (count($args) &lt; 1) {
          throw new \InvalidArgumentException('Magic request methods require a URI and optional options array');
      }
  
      $uri = $args[0];
      $opts = isset($args[1]) ? $args[1] : [];
  
      return substr($method, -5) === 'Async'
          ? $this-&gt;requestAsync(substr($method, 0, -5), $uri, $opts)
          : $this-&gt;request($method, $uri, $opts);
  }
  </code></pre>
  
  <p>I don't know what is changed between version 5 and 6 that makes this code not work anymore. Does anybody have a clue?</p>