diff --git a/src/Host.php b/src/Host.php index b8ee9a70..7e356882 100644 --- a/src/Host.php +++ b/src/Host.php @@ -9,11 +9,11 @@ class Host public bool $is_remote; public function __construct( - public string|null $identifier, + public ?string $identifier, public string $name, - public string|null $host = null, - public array|null $headers = null, - public array|null $auth = null, + public ?string $host = null, + public ?array $headers = null, + public ?array $auth = null, ) { $this->is_remote = $this->isRemote(); } diff --git a/src/Log.php b/src/Log.php index baeedec7..de148a7a 100644 --- a/src/Log.php +++ b/src/Log.php @@ -152,7 +152,7 @@ public function extractContextsFromFullText(): void if (json_last_error() == JSON_ERROR_CTRL_CHAR) { // might need to escape new lines - $json_data = json_decode(str_replace("\n", "\\n", $json_string), true); + $json_data = json_decode(str_replace("\n", '\\n', $json_string), true); } if (json_last_error() == JSON_ERROR_NONE) { diff --git a/src/Utils/GenerateCacheKey.php b/src/Utils/GenerateCacheKey.php index 57a5acde..c881b2f9 100644 --- a/src/Utils/GenerateCacheKey.php +++ b/src/Utils/GenerateCacheKey.php @@ -8,7 +8,7 @@ class GenerateCacheKey { - public static function for(mixed $object, ?string $namespace = null): string + public static function for(mixed $object, string $namespace = null): string { $key = ''; diff --git a/src/Utils/Utils.php b/src/Utils/Utils.php index 510438fb..291d7f2b 100644 --- a/src/Utils/Utils.php +++ b/src/Utils/Utils.php @@ -78,7 +78,7 @@ public static function glob_recursive($pattern, $flags = 0): bool|array { $files = glob($pattern, $flags); - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { $files = array_merge($files, static::glob_recursive($dir.'/'.basename($pattern), $flags)); } diff --git a/tests/Feature/Authorization/CanDeleteFoldersTest.php b/tests/Feature/Authorization/CanDeleteFoldersTest.php index c61dcce3..483e3067 100644 --- a/tests/Feature/Authorization/CanDeleteFoldersTest.php +++ b/tests/Feature/Authorization/CanDeleteFoldersTest.php @@ -23,14 +23,14 @@ test('"deleteLogFolder" gate can prevent folder deletion', function () { generateLogFiles([$fileName = 'laravel.log']); $folder = LogViewer::getFolder(''); - Gate::define('deleteLogFolder', fn (mixed $user, ?LogFolder $folder = null) => false); + Gate::define('deleteLogFolder', fn (mixed $user, LogFolder $folder = null) => false); $this->deleteJson(route('log-viewer.folders.delete', $folder->identifier)) ->assertForbidden(); test()->assertFileExists(storage_path('logs/'.$fileName)); // now let's allow access again - Gate::define('deleteLogFolder', fn (mixed $user, ?LogFolder $folder = null) => true); + Gate::define('deleteLogFolder', fn (mixed $user, LogFolder $folder = null) => true); $this->deleteJson(route('log-viewer.folders.delete', $folder->identifier)) ->assertOk(); diff --git a/tests/Feature/Authorization/CanDeleteLogFileTest.php b/tests/Feature/Authorization/CanDeleteLogFileTest.php index 11e6b694..2e2c0e05 100644 --- a/tests/Feature/Authorization/CanDeleteLogFileTest.php +++ b/tests/Feature/Authorization/CanDeleteLogFileTest.php @@ -18,14 +18,14 @@ test('"deleteLogFile" gate can prevent file deletion', function () { generateLogFiles([$fileName = 'laravel.log']); - Gate::define('deleteLogFile', fn (mixed $user, ?LogFile $file = null) => false); + Gate::define('deleteLogFile', fn (mixed $user, LogFile $file = null) => false); $this->deleteJson(route('log-viewer.files.delete', $fileName)) ->assertForbidden(); test()->assertFileExists(storage_path('logs/'.$fileName)); // now let's allow access again - Gate::define('deleteLogFile', fn (mixed $user, ?LogFile $file = null) => true); + Gate::define('deleteLogFile', fn (mixed $user, LogFile $file = null) => true); $this->deleteJson(route('log-viewer.files.delete', $fileName)) ->assertOk();