Is it possible to set a DateTime object as an optional parameter using now by default?
The following code gives me a syntax error :
public function getData(array $metrics, DateTime $start, DateTime $end = new DateTime, $params = array()) {
It's just a matter of curiosity, I know what I can do :
public function getData(array $metrics, DateTime $start, DateTime $end = null, $params = array()) { $end = is_null($end) ? new DateTime() : null; }
gremo source share