protected function outputNotNull($value): string
    {
        if (is_string($value)) {
            return $value;

        } elseif (is_int($value)) {
            $formats = $this->getFormats(self::DEFAULT_STYLE);
            return date($formats[0], $value);

        } elseif ($value instanceof \DateTime) {
            $formats = $this->getFormats(self::DEFAULT_STYLE);
            return $value->format($formats[0]);
        }

        throw TypeConversionException::unexpectedValue(
            $this,
            'output',
            'a string, an integer or an instance of DateTime',
            $value
        );
    }
protected function outputNotNull($value): string
    {
        if (is_string($value)) {
            return $value;

        } elseif (is_int($value)) {
            $formats = $this->getFormats(self::DEFAULT_STYLE);
            return date($formats[0], $value);

        } elseif ($value instanceof \DateTime) {
            $formats = $this->getFormats(self::DEFAULT_STYLE);
            return $value->format($formats[0]);
        }

        throw TypeConversionException::unexpectedValue(
            $this,
            'output',
            'a string, an integer or an instance of DateTime',
            $value
        );
    }
protected function outputNotNull ( $ value ) : string { if ( is_string ( $ value ) ) { return $ value ; } elseif ( is_int ( $ value ) ) { $ formats = $ this -> getFormats ( self :: DEFAULT_STYLE ) ; return date ( $ formats [ 0 ] , $ value ) ; } elseif ( $ value instanceof \ DateTime ) { $ formats = $ this -> getFormats ( self :: DEFAULT_STYLE ) ; return $ value -> format ( $ formats [ 0 ] ) ; } throw TypeConversionException :: unexpectedValue ( $ this , 'output' , 'a string, an integer or an instance of DateTime' , $ value ) ; }
Converts PHP variable not identical to null into native format

Note: a passed string will be returned as-is without any attempts to parse it.
PostgreSQL's date and time parser accepts a lot more possible formats than this
class can handle. Integer will be handled using date() with an appropriate
format specification.

@param string|integer|\DateTime $value
@return string
@throws TypeConversionException
Converts PHP variable not identical to null into native format