Fixed #929: constants with same name were overwritten

Whenever a constant had the same name as another constant in the
same file (but with a different namespace) then the latter would
overwrite the former.

During the fix for this bug I discovered the same behaviour for
functions, classes, interfaces and traits; which were fixed at
the same time.
[#929]: Add changelog