After doing some research on the namespace in PHP, I am trying to figure out what are the real benefits other than having library elements grouped together and reusing the same class name.
What I don't like about namespaces is the extra lines at the top of the file that you call in classes from "use core \ whatever \ class", which you don't need for the standard approach.
Also - something that I could not find information about what happens in a situation where we need to use two classes with the same name, but in different folders that contain the same method name? We would still need to name the namespace, but how would the code determine which method to use from the class?
I just started with namespaces, so excuse me if this question seems very simple.
Also - how does this work with static methods - for example, like the Helper class - should I also indicate that I need this namespace 'use core \ whatever \ Helper'?
source
share