It's generally safer to explicitly compare types as this was originally.

For this code, it really should not matter, but when working with a variable which is expected to be one of several types, comparing the type explicitly is just generally safer to prevent unwanted behavior and even security vulnerabilities.