I'm wrapping a C++ library in PHP using SWIG and there have been some occasions where I want to modify the generated code (both generated C++ and PHP):
- Fix code-generation errors
- Add code that makes sense in PHP, but not in C++ (e.g. type checking)
- Add documentation tags (e.g. phpDoc)
I'm currently automating these modifications with patch
. This approach works, but it seems high-maintenance and fragile. Is there a better way of doing this?