From ccc329eb3036a89d110227a4137e15d4a5661678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFck=20Piera?= Date: Tue, 20 Jun 2017 16:43:31 +0200 Subject: [PATCH] Fix compatibility with league/oauth2-client and PHP 7.1 (#14) * Fix compatibility with league/oauth2-client and PHP 7.1 * Fix HHVM build on travis --- .travis.yml | 5 ++++- composer.json | 4 ++-- src/Provider/Slack.php | 7 ++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e798b6..dbb8188 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: php +dist: trusty + php: - 5.6 - 7.0 + - 7.1 - hhvm before_script: @@ -16,4 +19,4 @@ script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover \ No newline at end of file + - php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/composer.json b/composer.json index 21d2f5a..912573d 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ } ], "require": { - "php": ">=5.6.0 <7.1", - "league/oauth2-client": "1.*" + "php": ">=5.6.0", + "league/oauth2-client": "1.*|2.*" }, "require-dev": { "mockery/mockery": "~0.9", diff --git a/src/Provider/Slack.php b/src/Provider/Slack.php index ffee159..2ed3ca5 100644 --- a/src/Provider/Slack.php +++ b/src/Provider/Slack.php @@ -115,7 +115,12 @@ public function fetchAuthorizedUserDetails(AccessToken $token) $request = $this->getAuthenticatedRequest(self::METHOD_GET, $url, $token); - return $this->getResponse($request); + // Keep compatibility with League\OAuth2\Client v1 + if (!method_exists($this, 'getParsedResponse')) { + return $this->getResponse($request); + } + + return $this->getParsedResponse($request); } /**