If this method returns several types, maybe it should be named ``guessTypes...``?

The method is very complex.
#Reassigning local variables is usually a bad style, because it makes code harder to comprehend and refactor.
#Combination of reassignments and deep if-else-if is even worse.
I offer extracting method guessTypesForDeclaration and use it immediately instead of assigning to declaration. This will allow removing reassigned variable and make each ``if`` end with ``return``, and ``else``s will be unnecessary.