src/Helper/TypeCheck.php
public static function doCheck()
    {
        $backtrace         = debug_backtrace();
        $functionArguments = $backtrace[1]['args'];
        $functionName      = $backtrace[1]['function'];
        $doChecks          = func_get_args();

        unset($backtrace);

        array_walk(
            $functionArguments,
            function ($value, $key) use (&$doChecks, $functionName) {
                if (is_null($value) || !isset($doChecks[$key]) || $doChecks[$key] == DataType::SKIP) {
                    return;
                }
                if (!TypeCheck::checkValue($value, $doChecks[$key])) {
                    if (is_callable($doChecks[$key])) {
                        $doChecks[$key] = 'unknown (custom validator)';
                    }
                    if (is_object($value)) {
                        $message = sprintf(
                            TypeCheck::MESSAGE,
                            $key,
                            $functionName,
                            $doChecks[$key],
                            'instance of ' . get_class($value)
                        );
                    } else {
                        $message = sprintf(
                            TypeCheck::MESSAGE,
                            $key,
                            $functionName,
                            $doChecks[$key],
                            gettype($value)
                        );
                    }
                    throw new InvalidArgumentException($message);
                }

            }
        );
    }
public static function doCheck()
    {
        $backtrace         = debug_backtrace();
        $functionArguments = $backtrace[1]['args'];
        $functionName      = $backtrace[1]['function'];
        $doChecks          = func_get_args();

        unset($backtrace);

        array_walk(
            $functionArguments,
            function ($value, $key) use (&$doChecks, $functionName) {
                if (is_null($value) || !isset($doChecks[$key]) || $doChecks[$key] == DataType::SKIP) {
                    return;
                }
                if (!TypeCheck::checkValue($value, $doChecks[$key])) {
                    if (is_callable($doChecks[$key])) {
                        $doChecks[$key] = 'unknown (custom validator)';
                    }
                    if (is_object($value)) {
                        $message = sprintf(
                            TypeCheck::MESSAGE,
                            $key,
                            $functionName,
                            $doChecks[$key],
                            'instance of ' . get_class($value)
                        );
                    } else {
                        $message = sprintf(
                            TypeCheck::MESSAGE,
                            $key,
                            $functionName,
                            $doChecks[$key],
                            gettype($value)
                        );
                    }
                    throw new InvalidArgumentException($message);
                }

            }
        );
    }
Check if function arguments match the provided types