[WIP] DCOM-118 - DCOM-121

This PR is a port of the hotfix for DCOM-121 at doctrine/common#198