It seems like $files can also be of type false; however, parameter $input of array_filter() does only seem to accept array, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
42
/** @scrutinizer ignore-type */ $files,
Loading history...
43
function ($k) {
44
$return = [];
45
if ($k !== '..' && $k !== '.') {
46
$return[] = $k;
47
}
48
return $return;
49
}
50
);
51
}
52
53
/**
54
* @return void
55
*/
56
public function removeOldFilesByIntervalDays(): void
It seems like you do not handle an error condition for unlink(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled annotation
If you suppress an error, we recommend checking for the error condition explicitly:
// For example instead of@mkdir($dir);// Better useif(@mkdir($dir)===false){thrownew\RuntimeException('The directory '.$dir.' could not be created.');}