Skip to content

Commit 2dddcea

Browse files
ozdemirburakjoshcanhelp
authored andcommitted
use casting which is faster than intval, remove default null assignments to class properties.
1 parent 551bb5e commit 2dddcea

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

src/API/Management/ClientGrants.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class ClientGrants extends GenericResource
3333
public function getAll(array $params = [], $page = null, $per_page = null)
3434
{
3535
if (null !== $page) {
36-
$params['page'] = abs(intval($page));
36+
$params['page'] = abs((int) $page);
3737
}
3838

3939
if (null !== $per_page) {
40-
$params['per_page'] = abs(intval($per_page));
40+
$params['per_page'] = abs((int) $per_page);
4141
}
4242

4343
return $this->apiClient->method('get')

src/API/Management/Clients.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getAll(
5151

5252
// Pagination.
5353
if (null !== $page) {
54-
$params['page'] = abs(intval($page));
54+
$params['page'] = abs((int) $page);
5555
if (null !== $per_page) {
5656
$params['per_page'] = $per_page;
5757
}

src/API/Management/Connections.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getAll(
5656

5757
// Pagination.
5858
if (null !== $page) {
59-
$params['page'] = abs(intval($page));
59+
$params['page'] = abs((int) $page);
6060
if (null !== $per_page) {
6161
$params['per_page'] = $per_page;
6262
}

src/API/Management/EmailTemplates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function create(
151151
'subject' => (string) $subject,
152152
'body' => (string) $body,
153153
'syntax' => (string) $syntax,
154-
'urlLifetimeInSeconds' => abs(intval($urlLifetime))
154+
'urlLifetimeInSeconds' => abs((int) $urlLifetime)
155155
];
156156

157157
if (! empty($resultUrl)) {

src/API/Management/ResourceServers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function getAll($page = null, $per_page = null)
3131

3232
// Pagination parameters.
3333
if (null !== $page) {
34-
$params['page'] = abs(intval($page));
34+
$params['page'] = abs((int) $page);
3535
}
3636

3737
if (null !== $per_page) {
38-
$params['per_page'] = abs(intval($per_page));
38+
$params['per_page'] = abs((int) $per_page);
3939
}
4040

4141
return $this->apiClient->method('get')

src/API/Management/Rules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function getAll($enabled = null, $fields = null, $include_fields = null,
4747

4848
// Pagination parameters.
4949
if (null !== $page) {
50-
$params['page'] = abs(intval($page));
50+
$params['page'] = abs((int) $page);
5151
}
5252

5353
if (null !== $per_page) {
54-
$params['per_page'] = abs(intval($per_page));
54+
$params['per_page'] = abs((int) $per_page);
5555
}
5656

5757
return $this->apiClient->method('get')

src/API/Management/Users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public function getAll(array $params = [], $fields = null, $include_fields = nul
142142

143143
// Keep existing pagination params if passed (backwards-compat), override with non-null function param if not.
144144
if (! isset($params['page']) && null !== $page) {
145-
$params['page'] = abs(intval($page));
145+
$params['page'] = abs((int) $page);
146146
}
147147

148148
if (! isset($params['per_page']) && null !== $per_page) {
149-
$params['per_page'] = abs(intval($per_page));
149+
$params['per_page'] = abs((int) $per_page);
150150
}
151151

152152
return $this->apiClient->method('get')

src/Auth0.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class Auth0
188188
*
189189
* @var string
190190
*/
191-
protected $idTokenAlg = null;
191+
protected $idTokenAlg;
192192

193193
/**
194194
* Valid audiences for ID tokens.
@@ -385,7 +385,7 @@ public function __construct(array $config)
385385
* @see \Auth0\SDK\API\Authentication::get_authorize_link()
386386
* @see https://auth0.com/docs/api/authentication#login
387387
*/
388-
public function login($state = null, $connection = null, $additionalParams = [])
388+
public function login($state = null, $connection = null, array $additionalParams = [])
389389
{
390390
$params = [];
391391
if ($this->audience) {

src/Helpers/JWKFetcher.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ class JWKFetcher
2222
*
2323
* @var CacheHandler|null
2424
*/
25-
private $cache = null;
25+
private $cache;
2626

2727
/**
2828
* Options for the Guzzle HTTP client.
2929
*
3030
* @var array
3131
*/
32-
private $guzzleOptions = null;
32+
private $guzzleOptions;
3333

3434
/**
3535
* JWKFetcher constructor.
@@ -111,7 +111,7 @@ public function fetchKeys($iss)
111111
*/
112112
public function requestJwkX5c($jwks_url, $kid = null)
113113
{
114-
$cache_key = $jwks_url.'|'.(string) $kid;
114+
$cache_key = $jwks_url.'|'.$kid;
115115

116116
$x5c = $this->cache->get($cache_key);
117117
if (! is_null($x5c)) {

src/JWTVerifier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class JWTVerifier
2323
*
2424
* @var JWKFetcher|null
2525
*/
26-
protected $JWKFetcher = null;
26+
protected $JWKFetcher;
2727

2828
/**
2929
* Algorithms supported.
@@ -46,15 +46,15 @@ class JWTVerifier
4646
*
4747
* @var array|null
4848
*/
49-
protected $authorized_iss = null;
49+
protected $authorized_iss;
5050

5151
/**
5252
* Application Client Secret.
5353
* Required for HS256 tokens.
5454
*
5555
* @var string|null
5656
*/
57-
protected $client_secret = null;
57+
protected $client_secret;
5858

5959
/**
6060
* Path to the JWKS for RS256 tokens.

0 commit comments

Comments
 (0)