protected function normalizeDates(array $query): array
    {
        array_walk_recursive($query, function (&$value) {
            if ($value instanceof \DateTime) {
                //MongoDate is always UTC, which is good :)
                $value = new UTCDateTime($value);
            }
        });

        return $query;
    }
protected function normalizeDates(array $query): array
    {
        array_walk_recursive($query, function (&$value) {
            if ($value instanceof \DateTime) {
                //MongoDate is always UTC, which is good :)
                $value = new UTCDateTime($value);
            }
        });

        return $query;
    }
protected function normalizeDates ( array $ query ) : array { array_walk_recursive ( $ query , function ( & $ value ) { if ( $ value instanceof \ DateTime ) { //MongoDate is always UTC, which is good :) $ value = new UTCDateTime ( $ value ) ; } } ) ; return $ query ; }
Converts DateTime objects into MongoDatetime.

@param array $query

@return array
Converts DateTime objects into MongoDatetime .