Right way to write PHP indeed. Sometimes I wish PHP itself was written this way.
Oh! The guide does not mention the case: if a class contains only one static method, please, use a function. It does not look as educated, but it's obviously a function.
Perhaps I'm misunderstanding what you're saying, but standalone functions cannot be namespaced or autoloaded. Static methods solve both of these problems. With late static binding there's no reason to avoid static methods any more.
Oh god yes. I ran into an extreme case of this recently. 200 something lines of class definition, class variables and internal private methods that end up chaining 5-deep, with a single public method.
Refactoring to a single function took it down to under 20 lines.
I wish I knew what motivated people to do things like this.
From my own experience, PHP developers who are introduced to OOP often get taught the Java-esque flavour of it. Classes for everything, abstractions and base classes and inheritance all over the place.
Hell, I even went there myself at one point, at first doing it to DRY up a bunch of procedural scripts, but later introducing more abstractions to bend the existing code to my will.
Now, I prefer simplicity and will often scrap code that jumps through all sorts of hoops just to do something simple.
pretty sure it's the same thing every time: coming from working on really big systems that need that much depth of abstraction to something simple that can be done in 20 lines and forgetting, or not understanding how to scale down. most common with c# or java coders doing client libs for php for their application.
It would depend on what else is in the class - descriptive class constants used by the one static method wouldn't be possible if it was 'just a function'.
Oh! The guide does not mention the case: if a class contains only one static method, please, use a function. It does not look as educated, but it's obviously a function.
Not PHP specific, I admit.