When the OptimisticLockingException is generated with the static function lockFailedVersionMismatch and the passed parameters are DateTime instances, the exception could not be thrown because the DateTime object is not implicitly converted to a string.
Removed unnecessary is_object() check
Merge branch 'DDC-2715' into 2.4