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

Replace custom autoloaders with Magento's implementation #34

Closed
shochdoerfer opened this issue May 21, 2020 · 4 comments
Closed

Replace custom autoloaders with Magento's implementation #34

shochdoerfer opened this issue May 21, 2020 · 4 comments

Comments

@shochdoerfer
Copy link
Member

To investigate: Could we use the Magento\Framework\TestFramework\Unit\Autoloader implementations to generate the code and autoload it instead of our own custom logic? Or maybe reimplement Magento\Framework\Code\Generator\Autoloader to get rid of the ObjectManager magic.

@makao
Copy link

makao commented Aug 18, 2020

For Magento projects you can use

parameters:
    bootstrapFiles:
        - dev/tests/static/framework/Magento/PhpStan/autoload.php

Reference - Magento
Reference - PHPStan

For developing custom modules you need to create (copy) autoloader in your module to be able to run PHPStan without installing whole Magento.

@shochdoerfer
Copy link
Member Author

Thanks for pointing out. That does make sense of course.

I am still undecided about how to drive this project forward as this project depends on a newer version of PHPStan compared to what Magento 2.4.0 depends on as outlined in #42.

@makao
Copy link

makao commented Aug 19, 2020

I think you shouldn't care which PHPStan version Magento is using as probably you don't want to test vendor code with it. I've used your package for testing project code located in app/code, we had used higher level than Magento is using and we were even patching some Magento core code to fix incorrect annotations.

When you create Magento project you can simply update your dev dependencies. Also every 3rd party module should test code itself, to sum up I think you should go with latest PHPStan, not latest used by Magento.

@shochdoerfer
Copy link
Member Author

I just realized that we actually can't rely on Magento's autoloader for module projects because the autoloader is not shipped in one of Magento's Composer dependencies. Guess we'll have to keep our own solution for now.

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