Fix namespace search

Fixes namespace search and fixes code according to PHP-CS-Fixer.