Checking the Magento core I see two patterns a class with the slash in the beginning and a class without it.
What would be the difference?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAs far as I can tell, there is none. I used to write the fully qualified class name with the leading slash and now I do it without the leading slash. Plugins, preferences, virtual types, arguments and anything else I have worked on have had no noticeable difference.
Looking at the phpClassName
simpleType in vendor/magento/framework/ObjectManager/etc/config.xsd
the pattern match for the start of the string is: \\?
(Match 0 or 1 of the \
character) so it would seem that that the expected input does not care.
The only difference there potentially could be is a negligible performance difference, however the effort to investigate, benchmark and identify the faster option would be better spent working on the code in your own modules.