DCOM-118 - DCOM-121

This PR is a port of doctrine/common#198 into the annotations repository.