protected static boolean expectingImplement(Environment env, TraceInfo trace,
                                                int index, Memory memory, Class<?> clazz) {
        if (!memory.isObject() || !memory.toValue(ObjectMemory.class).getClass().isAssignableFrom(clazz)) {
            String given = memory.getRealType().toString();
            if (memory.isObject())
                given = memory.toValue(ObjectMemory.class).getReflection().getName();

            env.warning(trace, "expects parameter " + index + " must implement "
                    + (clazz.isInterface() ? "interface " : "") + clazz.getSimpleName() +
                    ", " + given + " given");
            return false;
        }
        return true;
    }
Use expectingReference(Environment env, TraceInfo trace, Memory memory, String funcName)
jphp-runtime/src/php/runtime/ext/support/compile/FunctionsContainer.java