My quote in the original pull request comment explains. The functions `substr` and `strrpos` will handle these cases.
~~~
A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
~~~

This was pulled from: http://www.php.net/manual/en/language.oop5.basic.php