Skip to content

Commit bceff0d

Browse files
committed
Code revised with reactor
Applied rules: * RemoveAlwaysElseRector * StaticClosureRector
1 parent 8c46d96 commit bceff0d

File tree

8 files changed

+27
-38
lines changed

8 files changed

+27
-38
lines changed

install/installStart.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
header("Location: upgradeStart.php");
1212
exit;
1313
}
14-
else {
15-
echo "No installationType found in \$_GET.";
16-
}
14+
echo "No installationType found in \$_GET.";
1715

1816
?>

lib/api/rest/v1/tlRestApi.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function __construct()
125125

126126
// test route with anonymous function
127127
$this->app->get('/who',
128-
function (): void {
128+
static function (): void {
129129
echo __CLASS__ . ' : Get Route /who';
130130
});
131131

lib/api/rest/v2/tlRestApi.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function __construct()
141141
// GET Routes
142142
// test route with anonymous function
143143
$this->app->get('/who',
144-
function (): void {
144+
static function (): void {
145145
echo __CLASS__ . ' : You have called the Get Route /who';
146146
});
147147

lib/api/rest/v3/core/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use Psr\Http\Message\ServerRequestInterface as Request;
44
use Slim\App;
55

6-
return function (App $app): void {
6+
return static function (App $app): void {
77

88
// @20201124 - I do not understand this
99
// $app->get('/',World::class . ':hello');

lib/api/rest/v3/custom/routes/routesCustomExample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Slim\App;
1010

1111

12-
return function (App $app): void {
12+
return static function (App $app): void {
1313
$app->get('/CustomExample/whoAmI',
1414
array($app->restApiCustomExample,'whoAmI'));
1515

lib/experiments/google.php

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,26 @@
3030
unset($_SESSION['oauth2state']);
3131
exit('Invalid state');
3232
}
33-
else {
34-
35-
// Try to get an access token (using the authorization code grant)
36-
$token = $provider->getAccessToken('authorization_code',
37-
[
38-
'code' => $_GET['code']
39-
]);
40-
41-
// Optional: Now you have a token you can look up a users profile data
42-
try {
43-
// We got an access token, let's now get the owner details
44-
$ownerDetails = $provider->getResourceOwner($token);
45-
46-
// Use these details to create a new profile
47-
printf('Hello %s!', $ownerDetails->getFirstName());
48-
} catch (Exception $e) {
49-
50-
// Failed to get user details
51-
exit('Something went wrong: ' . $e->getMessage());
52-
}
53-
54-
// Use this to interact with an API on the users behalf
55-
echo $token->getToken();
33+
// Try to get an access token (using the authorization code grant)
34+
$token = $provider->getAccessToken('authorization_code',
35+
[
36+
'code' => $_GET['code']
37+
]);
38+
// Optional: Now you have a token you can look up a users profile data
39+
try {
40+
// We got an access token, let's now get the owner details
41+
$ownerDetails = $provider->getResourceOwner($token);
5642

57-
// Use this to get a new access token if the old one expires
58-
echo $token->getRefreshToken();
43+
// Use these details to create a new profile
44+
printf('Hello %s!', $ownerDetails->getFirstName());
45+
} catch (Exception $e) {
5946

60-
// Unix timestamp at which the access token expires
61-
echo $token->getExpires();
47+
// Failed to get user details
48+
exit('Something went wrong: ' . $e->getMessage());
6249
}
50+
// Use this to interact with an API on the users behalf
51+
echo $token->getToken();
52+
// Use this to get a new access token if the old one expires
53+
echo $token->getRefreshToken();
54+
// Unix timestamp at which the access token expires
55+
echo $token->getExpires();

lib/functions/common.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,7 @@ function priority_to_level($priority)
748748
if ($priority < $urgencyImportance->threshold['low']) {
749749
return LOW;
750750
}
751-
else {
752-
return MEDIUM;
753-
}
751+
return MEDIUM;
754752
}
755753

756754
/**

lib/functions/string_api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function string_insert_hrefs($p_string)
296296
# Find any URL in a string and replace it with a clickable link
297297
# From MantisBT 2.25.2
298298
$p_string = preg_replace_callback($s_url_regex,
299-
function ($p_match) {
299+
static function ($p_match) {
300300
$t_url_href = 'href="' . rtrim($p_match[1], '.') . '"';
301301
if (config_get('html_make_links') == LINKS_NEW_WINDOW) {
302302
$t_url_target = ' target="_blank"';

0 commit comments

Comments
 (0)