[WIP] Codegen errors

- [x] Remove duplication of interfaces
- [x] Fix fatal errors
Should be removed, consider skipping all this stuff for `PHP_VERSION_ID < 50401` instead