Fix a php warning when using --dir
Fix a issue with CamelCase in namespace when checking routes/services/events

Thanks @rxu