1 | <?php |
||
8 | class BackupCollection extends Collection |
||
9 | { |
||
10 | /** @var null|int */ |
||
11 | protected $sizeCache = null; |
||
12 | |||
13 | /** @var array */ |
||
14 | protected static $allowedMimeTypes = [ |
||
15 | 'application/zip', 'application/x-zip', 'application/x-gzip', |
||
16 | ]; |
||
17 | |||
18 | /** |
||
19 | * @param \Illuminate\Contracts\Filesystem\Filesystem|null $disk |
||
20 | * @param array $files |
||
21 | * |
||
22 | * @return \Spatie\Backup\BackupDestination\BackupCollection |
||
23 | */ |
||
24 | public static function createFromFiles($disk, array $files): self |
||
38 | |||
39 | /** |
||
40 | * @param \Illuminate\Contracts\Filesystem\Filesystem|null $disk |
||
41 | * @param string $path |
||
42 | * |
||
43 | * @return bool |
||
44 | */ |
||
45 | protected static function pathRepresentsBackup($disk, $path) |
||
50 | |||
51 | /** |
||
52 | * @param string $path |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | protected static function pathExtensionRepresentsBackup($path) |
||
60 | |||
61 | /** |
||
62 | * @param \Illuminate\Contracts\Filesystem\Filesystem|null $disk |
||
63 | * @param string $path |
||
64 | * |
||
65 | * @return bool |
||
66 | */ |
||
67 | protected static function pathMimeTypeRepresetsBackup($disk, $path) |
||
68 | { |
||
69 | // Some drivers throw exceptions when checking mime types. |
||
70 | try { |
||
71 | return in_array(static::pathMimeType($disk, $path), self::$allowedMimeTypes); |
||
72 | } catch (Exception $e) { |
||
73 | return false; |
||
74 | } |
||
75 | } |
||
76 | |||
77 | protected static function pathMimeType($disk, $path) |
||
81 | |||
82 | /** |
||
83 | * @return \Spatie\Backup\BackupDestination\Backup|null |
||
84 | */ |
||
85 | public function newest() |
||
89 | |||
90 | /** |
||
91 | * @return \Spatie\Backup\BackupDestination\Backup|null |
||
92 | */ |
||
93 | public function oldest() |
||
99 | |||
100 | public function size(): int |
||
108 | } |
||
109 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):