Instead of storing the allowed attribute names as an associative array, it stored them as a sequential array and then does an array_flip every time that validateAttributes is called in order to do efficient lookup.
It would be better just to do the array_flip once, at the time setupAttributeWhitelist is called.
In addition, Sanitizer::setupAttributeWhitelist() and Sanitizer::attributeWhitelist() are public methods (although code search shows no uses outside Sanitizer). They should be made private (after a suitable deprecation period).