Update Generator.php

Fixed inheritance issues and PHP warnings when generating