diff --git a/composer.json b/composer.json index 5564cb346..2edbaabb1 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,6 @@ ], "cs-check": "phpcs --colors -p", "cs-fix": "phpcbf --colors -p", - "stan": "phpstan analyze", "test": "phpunit --colors=always" } } diff --git a/src/Console/Installer.php b/src/Console/Installer.php index 847d9ded2..89aadda15 100644 --- a/src/Console/Installer.php +++ b/src/Console/Installer.php @@ -155,8 +155,7 @@ public static function setFolderPermissions(string $dir, IOInterface $io): void }; $walker = function (string $dir) use (&$walker, $changePerms): void { - /** @phpstan-ignore-next-line */ - $files = array_diff(scandir($dir), ['.', '..']); + $files = array_diff(scandir($dir) ?: [], ['.', '..']); foreach ($files as $file) { $path = $dir . '/' . $file; @@ -200,8 +199,12 @@ public static function setSecuritySaltInFile(string $dir, IOInterface $io, strin { $config = $dir . '/config/' . $file; $content = file_get_contents($config); + if ($content === false) { + $io->write('Config file not readable or not found: config/' . $file); + + return; + } - /** @phpstan-ignore-next-line */ $content = str_replace('__SALT__', $newKey, $content, $count); if ($count == 0) { @@ -232,7 +235,12 @@ public static function setAppNameInFile(string $dir, IOInterface $io, string $ap { $config = $dir . '/config/' . $file; $content = file_get_contents($config); - /** @phpstan-ignore-next-line */ + if ($content === false) { + $io->write('Config file not readable or not found: config/' . $file); + + return; + } + $content = str_replace('__APP_NAME__', $appName, $content, $count); if ($count == 0) {