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

composer-include-files dependency breaks autoload-dev files #66

Closed
stevethomas opened this issue Sep 23, 2022 · 3 comments
Closed

composer-include-files dependency breaks autoload-dev files #66

stevethomas opened this issue Sep 23, 2022 · 3 comments

Comments

@stevethomas
Copy link

stevethomas commented Sep 23, 2022

Kind of surprised the only reference to this I can is here: funkjedi/composer-include-files#7

Given this composer.json:

    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "tests/macros.php"
        ]
    },

The tests/macros.php file has stopped autoloading after installing this package and the 0.0.0/composer-include-files dependency.

I understand this is not an issue with this package per se, just wondering whether anyone is aware of a workaround? Seems like something that would break plenty of Laravel app test suites where files are autoloaded.

I made an attempt at debugging the composer plugin but hit a brick wall as I have close to zero knowledge of how composer plugins actually work, and the plugin appears to be based on something copy and pasted from composer v1.

@ivanvermeyen
Copy link
Contributor

ivanvermeyen commented Sep 23, 2022

Recently I got prompts from composer (while doing composer update I think) to allow such plugins, maybe this is related?

I had to add it to allow-plugins in composer.json:

    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "0.0.0/composer-include-files": true
        }
    },

Edit:
Going through the other issues, there may be a deeper cause to the issue, I'll try and see if I can figure it out...
Would be cool if there was another way to force the priority of autoload files...

@stevethomas
Copy link
Author

stevethomas commented Sep 25, 2022

Yep I was prompted to add to allow-plugins and accepted; if I set that to false then my error is resolved (meaning that the helpers file is not overloaded, my autoload-dev files are working again, and route() is back to the framework version), so I think the issue is definitely isolated to 0.0.0/composer-include-files.

FWIW this package still works fine, just that we lose the ability to generated localized routes with route() using the 4th parameter.

ivanvermeyen added a commit to ivanvermeyen/laravel-localized-routes that referenced this issue Mar 31, 2023
@ivanvermeyen
Copy link
Contributor

Using my home made solution for this now, it should be fixed in the 3.0 release. 🎉

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