Merge pull request #3860 from 9rnsr/refactor_hdrgen

[Refactoring] PrettyPrintVisitor
fix Issue 13275 - Wrong di header generation on if and foreach statements