Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"sort-packages": true
},
"require": {
"php": "^7.3 || ^8.0",
"php": "^8.1",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.0",
"php-http/httplug": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], arr
'scope' => implode(',', $scope),
];

return static::BASE_AUTHORIZATION_URL.'/'.$this->graphVersion.'/dialog/oauth?'.http_build_query($params, null, $separator);
return static::BASE_AUTHORIZATION_URL.'/'.$this->graphVersion.'/dialog/oauth?'.http_build_query($params, arg_separator: $separator);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/Facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,6 @@ public function getPaginationResults(GraphEdge $graphEdge, $direction)
/**
* Sends a request to Graph and returns the result.
*
* @param string $method
* @param string $endpoint
* @param array $params
* @param null|AccessToken|string $accessToken
* @param null|string $eTag
Expand All @@ -443,7 +441,7 @@ public function getPaginationResults(GraphEdge $graphEdge, $direction)
*
* @return Response
*/
public function sendRequest($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
public function sendRequest(string $method, string $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
Expand Down Expand Up @@ -513,7 +511,7 @@ public function newBatchRequest($accessToken = null, $graphVersion = null)
*
* @return Request
*/
public function request($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
public function request(string $method, string $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/RedirectLoginHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getLogoutUrl($accessToken, $next, $separator = '&')
'access_token' => $accessToken->getValue(),
];

return 'https://www.facebook.com/logout.php?'.http_build_query($params, null, $separator);
return 'https://www.facebook.com/logout.php?'.http_build_query($params, arg_separator: $separator);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Http/RequestBodyMultipart.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function getParamString($name, $value)
*/
private function getNestedParams(array $params)
{
$query = http_build_query($params, null, '&');
$query = http_build_query($params, arg_separator: '&');
$params = explode('&', $query);
$result = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Http/RequestBodyUrlEncoded.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function __construct(array $params)
*/
public function getBody()
{
return http_build_query($this->params, '', '&');
return http_build_query($this->params, arg_separator: '&');
}
}
19 changes: 4 additions & 15 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Request
/**
* @var string the HTTP method for this request
*/
protected $method;
protected string $method;

/**
* @var string the Graph endpoint for this request
Expand Down Expand Up @@ -92,7 +92,7 @@ class Request
* @param null|string $eTag
* @param null|string $graphVersion
*/
public function __construct(Application $app = null, $accessToken = null, $method = null, $endpoint = null, array $params = [], $eTag = null, $graphVersion = null)
public function __construct(Application $app = null, $accessToken = null, string $method = 'GET', $endpoint = null, array $params = [], $eTag = null, $graphVersion = null)
{
$this->setApp($app);
$this->setAccessToken($accessToken);
Expand Down Expand Up @@ -209,23 +209,12 @@ public function validateAccessToken()
}
}

/**
* Set the HTTP method for this request.
*
* @param string
* @param mixed $method
*/
public function setMethod($method)
public function setMethod(string $method): void
{
$this->method = strtoupper($method);
}

/**
* Return the HTTP method for this request.
*
* @return string
*/
public function getMethod()
public function getMethod(): string
{
return $this->method;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Url/UrlManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function removeParamsFromUrl($url, array $paramsToFilter)
}

if (count($params) > 0) {
$query = '?'.http_build_query($params, null, '&');
$query = '?'.http_build_query($params, arg_separator: '&');
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ public static function appendParamsToUrl($url, array $newParams = [])
}

if (strpos($url, '?') === false) {
return $url.'?'.http_build_query($newParams, null, '&');
return $url.'?'.http_build_query($newParams, arg_separator: '&');
}

list($path, $query) = explode('?', $url, 2);
Expand All @@ -89,7 +89,7 @@ public static function appendParamsToUrl($url, array $newParams = [])
// Sort for a predicable order
ksort($newParams);

return $path.'?'.http_build_query($newParams, null, '&');
return $path.'?'.http_build_query($newParams, arg_separator: '&');
}

/**
Expand Down