1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * MySQL current_timestamp() converter |
||||
5 | * |
||||
6 | * @param int|string $date |
||||
7 | * @return date |
||||
8 | */ |
||||
9 | function current_timestamp($date = null) |
||||
10 | { |
||||
11 | $timestamp = $date; |
||||
12 | if (is_string($date)) $timestamp = strtotime($date); |
||||
13 | if (is_null($date)) $timestamp = time(); |
||||
14 | return date("Y-m-d H:i:s", $timestamp); |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() It seems like
$timestamp can also be of type string ; however, parameter $timestamp of date() does only seem to accept integer|null , 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
![]() |
|||||
15 | } |
||||
16 |