Fixed fields declared dynamically and added return types to phpdoc