Skip to content

Commit 85b6344

Browse files
authored
Merge pull request #1032 from cakephp/5.x-phpstan
Fix up PHPStan.
2 parents fe836f3 + d2daefc commit 85b6344

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
],
5353
"cs-check": "phpcs --colors -p",
5454
"cs-fix": "phpcbf --colors -p",
55-
"stan": "phpstan analyze",
5655
"test": "phpunit --colors=always"
5756
}
5857
}

src/Console/Installer.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ public static function setFolderPermissions(string $dir, IOInterface $io): void
155155
};
156156

157157
$walker = function (string $dir) use (&$walker, $changePerms): void {
158-
/** @phpstan-ignore-next-line */
159-
$files = array_diff(scandir($dir), ['.', '..']);
158+
$files = array_diff(scandir($dir) ?: [], ['.', '..']);
160159
foreach ($files as $file) {
161160
$path = $dir . '/' . $file;
162161

@@ -200,8 +199,12 @@ public static function setSecuritySaltInFile(string $dir, IOInterface $io, strin
200199
{
201200
$config = $dir . '/config/' . $file;
202201
$content = file_get_contents($config);
202+
if ($content === false) {
203+
$io->write('Config file not readable or not found: config/' . $file);
204+
205+
return;
206+
}
203207

204-
/** @phpstan-ignore-next-line */
205208
$content = str_replace('__SALT__', $newKey, $content, $count);
206209

207210
if ($count == 0) {
@@ -232,7 +235,12 @@ public static function setAppNameInFile(string $dir, IOInterface $io, string $ap
232235
{
233236
$config = $dir . '/config/' . $file;
234237
$content = file_get_contents($config);
235-
/** @phpstan-ignore-next-line */
238+
if ($content === false) {
239+
$io->write('Config file not readable or not found: config/' . $file);
240+
241+
return;
242+
}
243+
236244
$content = str_replace('__APP_NAME__', $appName, $content, $count);
237245

238246
if ($count == 0) {

0 commit comments

Comments
 (0)