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

Already on GitHub? Sign in to your account

[Autoloading] Namespaces not correct when using --optimize-autoloader #2215

Closed
dirkluijk opened this Issue Aug 28, 2013 · 0 comments

Comments

Projects
None yet
2 participants

I don't know whether this is a bug, because this only occurs when the configuration is wrong. When using the -o option, autoloading will still succeed in which case it should fail, but when leaving out the -o option autoloading will fill (which I think is correct behaviour).

Example

Imagine the following directory structure:

├── vendor
│   ├── foobar
│       ├── doc
│       ├── src
│           ├── Bar.php
│       ├── composer.json

With class Bar being in the Foo namespace; Foo\Bar.

Note that the Foo directory is missing, so autoloading should fail!

But when leaving out the two backslashes \\ in composer.json:

{
    "name": "my/foobar",
    "autoload": {
        "psr-0": { "Foo": "" }
    }
}

install|update -o: autoloading succeeds --> unexpected behaviour?
install|update: autoloading fails

When using "psr-0": { "Foo\\": "" }:

install|update -o: autoloading fails
install|update: autoloading fails

Which is correct, because the Foo directory is missing.

@dirkluijk dirkluijk referenced this issue in ricardoper/TwitterOAuth Aug 28, 2013

Closed

Autoloading fails #1

@Seldaek Seldaek closed this Apr 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment