-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Doesn't seem to namespace Mustache #99
Comments
I found a tool to convert from PSR-0 to PSR-4: sdrobov/autopsr4. It's definitely beta software but interesting – in the same arena as Mozart. I played around with it and the following composer.json should work for you:
The php code in there is because running autopsr4 required being in the correct working directory and having the correct arguments passed via the command line. A little refactoring, some error handling and a vendor/bin script could have it running nicely in Composer scripts. <?php
require_once __DIR__ . "/vendor/autoload.php";
chdir("vendor/mustache/mustache/src/");
use AutoPsr4\Parser;
use AutoPsr4\Replacer;
use AutoPsr4\UsageFinder;
class Mustache_Replacer extends AutoPsr4\App {
public function run($argv) {
$parser = new Parser("Mustache", "Mustache");
$parser->parse();
$usageFinder = new UsageFinder($parser->getFiles(), $parser->getClasses());
$usageFinder->findUsages();
$replacer = new Replacer($usageFinder->getFiles());
$replacer->replace();
}
};
(new Mustache_Replacer())->run(array()); |
Thank you @BrianHenryIE, and sorry for the late answer. I tried to use AutoPsr4 and it almost worked. The main issue comes from Mustach's Exception classes, like this one: class Mustache_Exception_InvalidArgumentException extends InvalidArgumentException implements Mustache_Exception
{ Once all the prefixes removed and namespaces added, it becomes: namespace Screenfeed\AdminbarTools\Dependencies\Mustache\Exception;
use Screenfeed\AdminbarTools\Dependencies\Mustache\Exception;
class InvalidArgumentException extends InvalidArgumentException implements Exception
{ This obviously leads to a fatal error. Even after manually editing the 3 classes that have this issue, then:
That's too much things to fix imho, so I guess I'll stick with the classmap. |
Hello,
I'm trying to use Mozart
0.6.0-beta-3
with Mustache and other packages, but Mustache is the only one that doesn't seem to be namespaced.Fair warning, it's the first time I use Mozart so it can be a misconfiguration/misunderstanding on my side.
composer.json
composer.lock
Taking a look at my code the following classes are not found:
While this one is:
Then if I look at Mustache's files, they are moved to the right folder but no namespaces:
src/classes/Dependencies/Mustache/Engine.php
src/classes/Dependencies/Mustache/Loader/FilesystemLoader.php
Finally, I managed to prefix the classes by using a classmap:
Did I miss something?
Thanks.
The text was updated successfully, but these errors were encountered: