Add type-hinting in array_whitelist and check keys for type errors