Skip to content

Commit dc87311

Browse files
authored
Merge pull request #761 from cakephp/cs-fixes
Fixed cs errors. Added psalm composer scripts.
2 parents 14d6b6b + 03a489e commit dc87311

8 files changed

Lines changed: 20 additions & 24 deletions

File tree

composer.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,11 @@
5252
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
5353
},
5454
"scripts": {
55-
"cs-check": [
56-
"phpcs --colors --parallel=16 -p src/ tests/"
57-
],
58-
"cs-fix": [
59-
"phpcbf --colors --parallel=16 -p src/ tests/"
60-
],
61-
"test": [
62-
"phpunit"
63-
]
55+
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
56+
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
57+
"test": "phpunit",
58+
"psalm": "psalm.phar --show-info=false",
59+
"psalm-setup": "cp composer.json composer.backup && composer require --dev psalm/phar:^3.11 && mv composer.backup composer.json"
6460
},
6561
"prefer-stable": true
6662
}

src/Command/BenchmarkCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
5555
$times = [];
5656

5757
$io->out(Text::insert(__d('debug_kit', '-> Testing :url'), compact('url')));
58-
$io->out("");
58+
$io->out('');
5959
for ($i = 0; $i < $options['n']; $i++) {
6060
if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) {
6161
break;
@@ -86,7 +86,7 @@ protected function _results($times)
8686
$this->io->out(Text::insert(__d('debug_kit', 'Total Requests made: :requests'), compact('requests')));
8787
$this->io->out(Text::insert(__d('debug_kit', 'Total Time elapsed: :duration (seconds)'), compact('duration')));
8888

89-
$this->io->out("");
89+
$this->io->out('');
9090

9191
$this->io->out(Text::insert(__d('debug_kit', 'Requests/Second: :rps req/sec'), [
9292
'rps' => round($requests / $duration, 3),
@@ -105,7 +105,7 @@ protected function _results($times)
105105
'shortest' => round(min($times), 3),
106106
]));
107107

108-
$this->io->out("");
108+
$this->io->out('');
109109
}
110110

111111
/**

src/Controller/DebugKitController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function beforeFilter(EventInterface $event)
4646
$authorizationService->skipAuthorization();
4747
} else {
4848
Log::info(
49-
"Cake Authorization plugin is enabled. If you would like " .
50-
"to force DebugKit to ignore it, set `DebugKit.ignoreAuthorization` " .
51-
" Configure option to true."
49+
'Cake Authorization plugin is enabled. If you would like ' .
50+
'to force DebugKit to ignore it, set `DebugKit.ignoreAuthorization` ' .
51+
' Configure option to true.'
5252
);
5353
}
5454
}

src/Controller/MailPreviewController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function respondWithPart($email, $partType)
156156

157157
$response = $this->response->withType($partType);
158158
if ($partType === 'text') {
159-
$part = '<pre>' . (string)$part . "</pre>";
159+
$part = '<pre>' . (string)$part . '</pre>';
160160
}
161161
$response = $response->withStringBody($part);
162162

@@ -199,8 +199,8 @@ protected function getMailPreviewClasses()
199199
}
200200
})
201201
->unfold(function ($path, $plugin) {
202-
foreach (glob($path . "*Preview.php") as $file) {
203-
$base = str_replace(".php", "", basename($file));
202+
foreach (glob($path . '*Preview.php') as $file) {
203+
$base = str_replace('.php', '', basename($file));
204204
$class = App::className($plugin . $base, 'Mailer/Preview');
205205
if ($class) {
206206
yield ['plugin' => trim($plugin, '.'), 'class' => new $class()];
@@ -266,7 +266,7 @@ protected function findPreview($previewName, $emailName, $plugin = '')
266266
$plugin = "$plugin.";
267267
}
268268

269-
$realClass = App::className($plugin . $previewName, "Mailer/Preview");
269+
$realClass = App::className($plugin . $previewName, 'Mailer/Preview');
270270
if (!$realClass) {
271271
throw new NotFoundException("Mailer preview ${previewName} not found");
272272
}
@@ -276,7 +276,7 @@ protected function findPreview($previewName, $emailName, $plugin = '')
276276
if (!$email) {
277277
throw new NotFoundException(__d(
278278
'debug_kit',
279-
"Mailer preview {0}::{1} not found",
279+
'Mailer preview {0}::{1} not found',
280280
$previewName,
281281
$emailName
282282
));

src/Panel/RequestPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function shutdown(EventInterface $event)
3434
$controller = $event->getSubject();
3535
$request = $controller->getRequest();
3636
$this->_data = [
37-
'params' => $request->getAttribute("params"),
37+
'params' => $request->getAttribute('params'),
3838
'query' => $request->getQueryParams(),
3939
'data' => $request->getData(),
4040
'cookie' => $request->getCookieParams(),

src/ToolbarService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function isSuspiciouslyProduction()
145145
Log::warning(
146146
"DebugKit is disabling itself as your host `{$host}` " .
147147
"is not in the known safe list of top-level-domains ({$safeList}). " .
148-
"If you would like to force DebugKit on use the `DebugKit.forceEnable` Configure option."
148+
'If you would like to force DebugKit on use the `DebugKit.forceEnable` Configure option.'
149149
);
150150

151151
return true;

src/View/Helper/CredentialsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function filter($in)
5858
$link = $this->Html->tag('a', '******', [
5959
'class' => 'filtered-credentials',
6060
'title' => h($credentials),
61-
'onclick' => "this.innerHTML = this.title",
61+
'onclick' => 'this.innerHTML = this.title',
6262
]);
6363

6464
return h($protocol) . $link . '@' . h($tail);

src/View/Helper/SimpleGraphHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function bar($value, $offset, $options = [])
7373
'<div class="graph-bar" style="%s"><div class="graph-bar-value" style="%s" title="%s"> </div></div>',
7474
"width: {$width}px",
7575
"margin-left: {$graphOffset}px; width: {$graphValue}px",
76-
__d('debug_kit', "Starting {0}ms into the request, taking {1}ms", $offset, $value)
76+
__d('debug_kit', 'Starting {0}ms into the request, taking {1}ms', $offset, $value)
7777
);
7878
}
7979
}

0 commit comments

Comments
 (0)