protected function checkUniqueness(array $values)
    {
        \set_error_handler(
            function ($errno, $errstr, $errfile, $errline) {
                if (E_RECOVERABLE_ERROR===$errno) {
                    throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
                }
                return false;
            },
            E_RECOVERABLE_ERROR
        );

        try {
            //see if we can turn a value into a string
            $toTest = end($values);
            reset($values);
            (string) $toTest; //this will throw an exception if it fails
            \restore_error_handler();

            //do the simple
            return array_values(array_unique($values));
        } catch (\ErrorException $e) {
            \restore_error_handler();

            //slower but effective
            return array_values(
                array_map(
                    function ($key) use ($values) {
                        return $values[$key];
                    },
                    array_keys(
                        array_unique(
                            array_map(
                                function ($item) {
                                    return serialize($item);
                                },
                                $values
                            )
                        )
                    )
                )
            );
        }
    }