Git Product home page Git Product logo

Comments (20)

sandervanhooft avatar sandervanhooft commented on June 6, 2024

(I ran composer du)

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024

@sandervanhooft have your tried classmap?

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

yes, no luck there either yet. Not completely sure yet what I should put in there in this case tbh

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

Hang on, I think you're right

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024

I've just created a bunch of random classes in a file and required it using the autoload.files, and I can autoload them just fine on composer 2.0.11.

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

autoload.classmap seems to do the trick here

autoload.files doesn't somehow

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

(also on composer 2.0.11 here)

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024

That's weird, the autoload.files should just always be loaded. There shouldn't be any difference between composer 1 and 2 here since it's always used for loading functions... very strange

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

So this works:

"autoload": {
        "classmap": [
            "src/Domain/SomeModule/commands_and_events.php"
        ],
        "psr-4": {
            "App\\": "src/App/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/",
            "Domain\\": "src/Domain/",
            "Support\\": "src/Support/"
        }
    },

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

Note that src/Domain is also used in autoload.psr-4, looks to me as if the autoload.psr-4 runs after the autoload.files and then decides to skip/remove the files (edit)

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

So it may be a composer autoloader hierarchy issue

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024
{
    "name": "test/something",
    "autoload": {
        "psr-4": {
            "Domain\\": "src/Domain"
        },
        "files": [
            "src/Domain/classes.php"
        ]
    },
    "require": {
        "eventsauce/eventsauce": "^0.8.2"
    }
}

this works for me

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

Still getting the same warnings / skips here... Even after a complete reinstall

rm -rf composer.lock vendor && composer update

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024

@sandervanhooft can you share an example repo with me where you experience this issue?

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

It's solved when using the classmap

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

Let me see if I can whip something up for you

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

Here you go:

https://github.com/sandervanhooft/es_composer_issue

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

It's using the Laravel wrapper, I don't expect that will be the cause.

Here's my output

image

from eventsauce.

frankdejonge avatar frankdejonge commented on June 6, 2024

@sandervanhooft ah now I understand what you meant. Then yeah, this is expected behaviour and the class-map is the solution. Your issue didn't specify during which operation it skipped the files and it seems your installation is configured to optimise the autoloader always (https://github.com/sandervanhooft/es_composer_issue/blob/main/composer.json#L28), so when I dumped it didn't give me this message. I then assumed you meant it skipped it when trying to load it. Which is then of course not the case. Mystery solved for me at least. Then the answer is relatively simple, use class-map :)

from eventsauce.

sandervanhooft avatar sandervanhooft commented on June 6, 2024

"optimize-autoloader": true,

Oh my that's a nifty little bugger.

That's standard Laravel boilerplate. Good to be aware of this. Thanks!

from eventsauce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.