Fix unused imports
Remove unused variables
Add test case for constructor method
Merge branch 'hotfix/#6093-dead-code-cleanups'

Close #6093
Merge branch 'master' into suggest-ext-mcrypt

update