PSR-1 is just talking about the top-level code in the file. That top-level code should either be causing side effects or declaring things.
In your example, you're defining a class and its methods. The side effect doesn't happen when loading the file, it happens when you call the function. To be PSR-1 compliant, that call should not be in the top-level code of this file.