Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Filter/Doctrine/Expression/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public function between($field, $min, $max)
* Returns lte expression if max is null
* Returns gte expression if min is null
*
* @param string $field field name
* @param null|\DateTime $min start date
* @param null|\DateTime $max end date
* @param string $field field name
* @param null|\DateTimeInterface $min start date
* @param null|\DateTimeInterface $max end date
*
* @return Comparison|string
*/
Expand Down Expand Up @@ -136,9 +136,9 @@ public function dateInRange($field, $min = null, $max = null)
* Returns lte expression if max is null
* Returns gte expression if min is null
*
* @param string|\DateTime $value alias.fieldName or mysql date string format or DateTime
* @param string|\DateTime $min alias.fieldName or mysql date string format or DateTime
* @param string|\DateTime $max alias.fieldName or mysql date string format or DateTime
* @param string|\DateTimeInterface $value alias.fieldName or mysql date string format or DateTime
* @param string|\DateTimeInterface $min alias.fieldName or mysql date string format or DateTime
* @param string|\DateTimeInterface $max alias.fieldName or mysql date string format or DateTime
* @return Comparison|string
*/
public function dateTimeInRange($value, $min = null, $max = null)
Expand Down Expand Up @@ -172,9 +172,9 @@ public function dateTimeInRange($value, $min = null, $max = null)
/**
* Get string like expression
*
* @param string $field field name
* @param string $value string value
* @param int $type one of FilterOperands::STRING_* constant
* @param string $field field name
* @param string $value string value
* @param int $type one of FilterOperands::STRING_* constant
*
* @return Comparison|string
*/
Expand All @@ -191,14 +191,14 @@ public function stringLike($field, $value, $type = FilterOperands::STRING_CONTAI
/**
* Normalize DateTime boundary
*
* @param \DateTime $date
* @param bool $isMax
* @param \DateTimeInterface $date
* @param bool $isMax
*
* @return Literal|string
*/
protected function convertToSqlDate($date, $isMax = false)
{
if (!$date instanceof \DateTime) {
if (!$date instanceof \DateTimeInterface) {
return;
}

Expand All @@ -214,12 +214,12 @@ protected function convertToSqlDate($date, $isMax = false)
/**
* Normalize date time boundary
*
* @param \DateTime|string $date
* @param \DateTimeInterface|string $date
* @return Literal
*/
protected function convertToSqlDateTime($date)
{
if ($date instanceof \DateTime) {
if ($date instanceof \DateTimeInterface) {
$date = $this->expr()->literal($date->format(self::SQL_DATE_TIME));
}

Expand All @@ -230,7 +230,7 @@ protected function convertToSqlDateTime($date)
* Prepare value for like operation
*
* @param string $value
* @param int $type one of FilterOperands::STRING_*
* @param int $type one of FilterOperands::STRING_*
*
* @return string
*
Expand Down