<?php

namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\QueryException;

/**
 * @author Vas N <phpvas@gmail.com>
 */
class DateSub extends DateAdd
{
    public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
    {
        $unit = strtoupper(is_string($this->unit) ? $this->unit : $this->unit->value);

        if (!in_array($unit, self::$allowedUnits)) {
            throw QueryException::semanticalError('DATE_SUB() does not support unit "' . $unit . '".');
        }

        return 'DATE_SUB(' .
            $this->firstDateExpression->dispatch($sqlWalker) . ', INTERVAL ' .
            $this->intervalExpression->dispatch($sqlWalker) . ' ' . $unit .
        ')';
    }
}

<?php

namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\Lexer,
    Doctrine\ORM\Query\QueryException;

/**
 * @author Vas N <phpvas@gmail.com>
 */
class DateSub extends DateAdd
{
    public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
    {
        $unit = strtoupper(is_string($this->unit) ? $this->unit : $this->unit->value);

        if (!in_array($unit, self::$allowedUnits)) {
            throw QueryException::semanticalError('DATE_SUB() does not support unit "' . $unit . '".');
        }

        return 'DATE_SUB(' .
            $this->firstDateExpression->dispatch($sqlWalker) . ', INTERVAL ' .
            $this->intervalExpression->dispatch($sqlWalker) . ' ' . $unit .
        ')';
    }
}

--- 
+++ 
@@ -2,8 +2,7 @@
 
 namespace DoctrineExtensions\Query\Mysql;
 
-use Doctrine\ORM\Query\Lexer,
-    Doctrine\ORM\Query\QueryException;
+use Doctrine\ORM\Query\QueryException;
 
 /**
  * @author Vas N <phpvas@gmail.com>
UPDATE - Unused use class removed.