[BUGFIX] namespace declaration may be on a line below the second

The current implementation only checks the first two line. This
patch changes this behaviour to continue to check until the first
occurence of the "namespace" or "class" keyword.