PHP: Replace constant Generation
(cherry picked from commit 76d2426d82b92d20fc35311e24d364c8d42ab3a9)