Issues (994)

src/shim/mysql-func.php (2 issues)

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
The expression return date('Y-m-d H:i:s', $timestamp) returns the type string which is incompatible with the documented return type date.
Loading history...
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 ignore-type  annotation

14
  return date("Y-m-d H:i:s", /** @scrutinizer ignore-type */ $timestamp);
Loading history...
15
}
16