Add phpstan level 7(#544)

This commit is contained in:
Saeed Vaziry
2025-03-12 13:31:10 +01:00
committed by GitHub
parent c22bb1fa80
commit 493cbb0849
437 changed files with 4505 additions and 2193 deletions

View File

@ -9,10 +9,14 @@ private function prepareS3Path(string $path, string $prefix = ''): string
$path = trim($path);
$path = ltrim($path, '/');
$path = preg_replace('/[^a-zA-Z0-9\-_\.\/]/', '_', $path);
$path = preg_replace('/\/+/', '/', $path);
$path = preg_replace('/\/+/', '/', (string) $path);
if ($prefix) {
$path = trim($prefix, '/').'/'.$path;
if ($prefix !== '' && $prefix !== '0') {
return trim($prefix, '/').'/'.$path;
}
if ($path === null) {
throw new \Exception('Invalid S3 path');
}
return $path;