Bug 421328 - fix for performance issue with TraitUtils.parse()

The initial patch in https://git.eclipse.org/r/18220 assumed that PHP
types (classes, interfaces and traits) can be defined only in the global
scope or inside a namespace. This is incomplete - types can be defined
also in the scope of other blocks like if-then-else, while/for/foreach
loops, try-catch, etc as long as the respective block is outside of
another type declaration (in PHP types cannot be nested).

This patch covers these additional use cases. Tests added to the suite.

Bug: 421328
Change-Id: I5283d687386e4aaac60f96e44f5add1e519762a4
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>