My PHP applications are generally using classes for namespacing. The methods within these classes are defined as static.
Now that PHP has introduced Traits, I'm trying to wrap my head around when to use them. I saw some examples of using traits, but I'm thinking this could just as easily be implemented through a static class method.
A quite thorough example using a logger was listed here: Traits in PHP – any real world examples/best practices?
But why use a Trait, if you could also use a static Logger::log()? The only thing I can think of just now, is easy access to $this. Another example I am facing right now, is a user-exists function. Trait it, or static method it?
Can anyone shed some light on this?