Skip to content

Commit 159dc38

Browse files
committed
Apply coding standard fixes
1 parent 56447c9 commit 159dc38

16 files changed

Lines changed: 50 additions & 46 deletions

config/app.default.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cake\Database\Driver\Mysql;
66
use Cake\Log\Engine\FileLog;
77
use Cake\Mailer\Transport\MailTransport;
8+
89
use function Cake\Core\env;
910

1011
return [

config/bootstrap.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
/**
@@ -45,6 +46,7 @@
4546
use Cake\Routing\Router;
4647
use Cake\Utility\Security;
4748
use Detection\MobileDetect;
49+
4850
use function Cake\Core\env;
4951

5052
/*
@@ -84,7 +86,7 @@
8486
try {
8587
Configure::config('default', new PhpConfig());
8688
Configure::load('app', 'default', false);
87-
} catch (Exception $e) {
89+
} catch (Throwable $e) {
8890
exit($e->getMessage() . "\n");
8991
}
9092

@@ -155,6 +157,7 @@
155157
if (Configure::check('Log.debug')) {
156158
Configure::write('Log.debug.file', 'cli-debug');
157159
}
160+
158161
if (Configure::check('Log.error')) {
159162
Configure::write('Log.error.file', 'cli-error');
160163
}
@@ -173,7 +176,7 @@
173176
* Example: APP_FULL_BASE_URL=https://example.com
174177
*/
175178
$fullBaseUrl = Configure::read('App.fullBaseUrl');
176-
if (!$fullBaseUrl) {
179+
if (! $fullBaseUrl) {
177180
$httpHost = env('HTTP_HOST');
178181

179182
/*
@@ -186,13 +189,17 @@
186189
if (env('HTTPS') || env('HTTP_X_FORWARDED_PROTO') === 'https') {
187190
$s = 's';
188191
}
192+
189193
$fullBaseUrl = 'http' . $s . '://' . $httpHost;
190194
}
195+
191196
unset($httpHost, $s);
192197
}
198+
193199
if ($fullBaseUrl) {
194200
Router::fullBaseUrl($fullBaseUrl);
195201
}
202+
196203
unset($fullBaseUrl);
197204

198205
/*
@@ -211,12 +218,12 @@
211218
* If you don't use these checks you can safely remove this code
212219
* and the mobiledetect package from composer.json.
213220
*/
214-
ServerRequest::addDetector('mobile', function ($request) {
221+
ServerRequest::addDetector('mobile', static function ($request) {
215222
$detector = new MobileDetect();
216223

217224
return $detector->isMobile();
218225
});
219-
ServerRequest::addDetector('tablet', function ($request) {
226+
ServerRequest::addDetector('tablet', static function ($request) {
220227
$detector = new MobileDetect();
221228

222229
return $detector->isTablet();

config/paths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/*
1616
* Use the DS to separate the directories in other defines
1717
*/
18-
if (!defined('DS')) {
18+
if (! defined('DS')) {
1919
define('DS', DIRECTORY_SEPARATOR);
2020
}
2121

config/routes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* So you can use `$this` to reference the application class instance
3030
* if required.
3131
*/
32-
return function (RouteBuilder $routes): void {
32+
return static function (RouteBuilder $routes): void {
3333
/*
3434
* The default class to use for all routes
3535
*
@@ -137,4 +137,4 @@
137137
* });
138138
* ```
139139
*/
140-
};
140+
};

src/Application.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
/**
@@ -14,6 +15,7 @@
1415
* @since 3.3.0
1516
* @license https://opensource.org/licenses/mit-license.php MIT License
1617
*/
18+
1719
namespace App;
1820

1921
use App\Middleware\HostHeaderMiddleware;
@@ -36,14 +38,12 @@
3638
* This defines the bootstrapping logic and middleware layers you
3739
* want to use in your application.
3840
*
39-
* @extends \Cake\Http\BaseApplication<\App\Application>
41+
* @extends BaseApplication<Application>
4042
*/
4143
class Application extends BaseApplication
4244
{
4345
/**
4446
* Load all the application configuration and bootstrap logic.
45-
*
46-
* @return void
4747
*/
4848
public function bootstrap(): void
4949
{
@@ -57,8 +57,8 @@ public function bootstrap(): void
5757
/**
5858
* Setup the middleware queue your application will use.
5959
*
60-
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup.
61-
* @return \Cake\Http\MiddlewareQueue The updated middleware queue.
60+
* @param MiddlewareQueue $middlewareQueue The middleware queue to setup.
61+
* @return MiddlewareQueue The updated middleware queue.
6262
*/
6363
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
6464
{
@@ -90,18 +90,15 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
9090

9191
// Cross Site Request Forgery (CSRF) Protection Middleware
9292
// https://book.cakephp.org/5/en/security/csrf.html#cross-site-request-forgery-csrf-middleware
93-
->add(new CsrfProtectionMiddleware([
94-
'httponly' => true,
95-
]));
93+
->add(new CsrfProtectionMiddleware(['httponly' => true]));
9694

9795
return $middlewareQueue;
9896
}
9997

10098
/**
10199
* Register application container services.
102100
*
103-
* @param \Cake\Core\ContainerInterface $container The Container to update.
104-
* @return void
101+
* @param ContainerInterface $container The Container to update.
105102
* @link https://book.cakephp.org/5/en/development/dependency-injection.html#dependency-injection
106103
*/
107104
public function services(ContainerInterface $container): void
@@ -113,8 +110,6 @@ public function services(ContainerInterface $container): void
113110
/**
114111
* Register custom event listeners here
115112
*
116-
* @param \Cake\Event\EventManagerInterface $eventManager
117-
* @return \Cake\Event\EventManagerInterface
118113
* @link https://book.cakephp.org/5/en/core-libraries/events.html#registering-listeners
119114
*/
120115
public function events(EventManagerInterface $eventManager): EventManagerInterface

src/Controller/AppController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
* will inherit them.
3939
*
4040
* @see http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
41-
*
4241
*/
4342
class AppController extends Controller
4443
{

src/Controller/DevelopersController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public function logout(): Response
112112
'You have been logged out successfully',
113113
['params' => ['class' => $flash_class]]
114114
);
115+
115116
return $this->redirect('/');
116117
}
117118

src/Controller/GithubController.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
use App\Controller\Component\GithubApiComponent;
2222
use Cake\Core\Configure;
2323
use Cake\Http\Exception\NotFoundException;
24+
use Cake\Http\Response;
2425
use Cake\Log\Log;
2526
use Cake\ORM\TableRegistry;
2627
use Cake\Routing\Router;
27-
use Cake\Http\Response;
2828
use InvalidArgumentException;
2929

30-
use function __;
3130
use function array_key_exists;
3231
use function explode;
3332
use function in_array;
@@ -117,14 +116,15 @@ public function create_issue($reportId): ?Response
117116
'_name' => 'reports:view',
118117
'id' => $reportId,
119118
]);
120-
} else {
121-
$flash_class = 'alert alert-error';
122-
$this->Flash->set(
123-
$this->getErrors($issueDetails, $status),
124-
['params' => ['class' => $flash_class]]
125-
);
126-
return null;
127119
}
120+
121+
$flash_class = 'alert alert-error';
122+
$this->Flash->set(
123+
$this->getErrors($issueDetails, $status),
124+
['params' => ['class' => $flash_class]]
125+
);
126+
127+
return null;
128128
}
129129

130130
/**
@@ -486,7 +486,6 @@ protected function getReportStatusFromIssueState(string $issueState): string
486486
* To be used as a cron job (using webroot/cron_dispatcher.php).
487487
*
488488
* Can not (& should not) be directly accessed via web.
489-
*
490489
*/
491490
public function sync_issue_status(): ?Response
492491
{

src/Controller/IncidentsController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Cake\Http\Response;
2929
use Cake\ORM\TableRegistry;
3030

31-
use function __;
3231
use function array_merge;
3332
use function count;
3433
use function in_array;
@@ -40,7 +39,6 @@
4039

4140
/**
4241
* Incidents controller handling incident creation and rendering.
43-
*
4442
*/
4543
class IncidentsController extends AppController
4644
{

src/Controller/NotificationsController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
namespace App\Controller;
2020

21-
use App\Model\Table\NotificationsTable;
2221
use App\Model\Table\DevelopersTable;
22+
use App\Model\Table\NotificationsTable;
2323
use App\Model\Table\ReportsTable;
2424
use Cake\Event\EventInterface;
2525
use Cake\Http\Response;
@@ -189,6 +189,7 @@ public function mass_action(): Response
189189
$msg,
190190
['params' => ['class' => $flash_class]]
191191
);
192+
192193
return $this->redirect('/notifications/');
193194
}
194195
}

0 commit comments

Comments
 (0)