Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR-4 Autoloading #9

Open
jeremyworboys opened this issue Feb 4, 2014 · 2 comments
Open

PSR-4 Autoloading #9

jeremyworboys opened this issue Feb 4, 2014 · 2 comments

Comments

@jeremyworboys
Copy link

Any chance of getting support for PSR-4?

I imagine this will add a level of complexity as you will now need to interpret composer.json for the root namespace.

@Heer0
Copy link

Heer0 commented Feb 7, 2014

I don't see where the plugin requires special support for the PSR-4?

If I understand correctly, only the file structure changes between PSR-0 and PSR-4, the "namespace" written in the PHP file is the same right?

The plugin searchs and uses the "namespace" that is before the keyword "class", "interface", "trait", etc.. in the file to build the "use". it should not be a change with PSR-4.

If there is a subtlety that I don't understand, thank you explain it to me.

@jeremyworboys
Copy link
Author

The issue I am having is with the php_namespace_insert_namespace command.

My composer.json looks like this:

{
  [...]
  "autoload": {
    "psr-4": {
      "Jeremyworboys\\Package\\": "src"
    }
  },
  [...]
}

If I then run the php_namespace_insert_namespace within src/File.php, nothing is inserted (instead of the expected namespace Jeremyworboys\Package;).

If I run the command from src/Exceptions/SomeException.php it inserts namespace Exceptions; instead of namespace Jeremyworboys\Package\Exceptions;

Basically, it isn't prefixing the vendor and package namespace from composer.json when inserting the namespace into the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants