Hello,
I'm wanting to use underscores in my modules (eg: ~/modules/my_module). The documentation doesn't include this scenario and it seems very restrictive to me if we can't.
I think in this case, the naming convention for the namespace should follow the same coding standards as for the classes.
But it doesn't seems to be allowed now (the Fuel::add_module() method still uses ucfirst() and not Inflector::words_to_upper() to compute the namespace name).
Is that a bug, a missing feature or something planned to never come? (in the formers cases, i'll add an issue on Github).
Thanks in advance for the answer.
It's a known limitation, if you know a way to do it in nicely we're always open to suggestions (read: pull-requests).
Fair warning: we won't sacrifice a shitload of performance or take some ugly hacks into the core to satisfy a very tiny number of people who might need this. If the latter is the case you can always extend Fuel, that's why we're so crazy-extendable.
The underscore caught me out and it was not easy to find the problem with the provided error messages.
https://wiki.php.net/rfc/namespaceseparator
I done a quick search and discovered that the backslash is acceptable in PHP 5.3 unfortunately Fuel throws a wobbler.
Instead of using underscores I would be tempted to use a common namespace and use a parameter for special cases.
Yes, I wanted to use sub-namespaces at first. I have a "hacked" solution for both problems right now, but not something you will want to pull into the Core (perfs are ok that said).
I'll see what I can do.
Well, actually after further testing, it works when loading classes. The Autoloader::load() matches the namespace without case, so the classes are correctly loaded inside underscored namespaces, whichever convention is used.
The problem remains for loading views or config files because Fuel::find_file() uses Autoloader::namespace_path() to retrieve the path, which IS case-sensitive.
And also there are those numerous '\\' prepended to module namespaces everywhere. This feels so wrong and is a pain in the ass. Really.