Comments (6)
Thanks for opening an issue first to discuss things.
First of all, yes what is called mocks are actually stubs. The reasoning behind this is that I did not want to confuse people (well, mainly me) with the stubs from PHPStan as they behave fundamentally differently and I could not come up with a better name.
It does not make sense to rely on PHPStan's stubs because doing that would mean we have to add half of Magento's codebase to this repo. The "problem" with PHPStan's stubs (at least the last time I looked at it) was, that you have to add any class you import/use as a stub as well. In our approach, the autoloader simply loads a different implementation if it exists. From that perspective, things work as they should for me.
Does it make sense to move the files out of the src
folder? Maybe. Is it worth it? Probably not.
In an ideal world, the subs/mocks would be located in a separate Composer package that depends on a matching Magento version. Because currently, technically false positives could occur when Magento changes one of the classes that we stored as stub/mock. However, I decided against that approach for now, because it simply is way too much management overhead to create a separate package per Magento version and maintain that. Also, so far no one reported false positives from the stub/mock files we provide. As long as that does not happen, I'll leave things as they are.
from phpstan-magento.
I see you call stubs "mock".
from phpstan-magento.
I think
parameters:
stubFiles:
could be used instead of a custom solution.
from phpstan-magento.
you have to add any class you import/use as a stub as well
YES!!
from phpstan-magento.
to create a separate package per Magento version and maintain that
@shochdoerfer Would you like me to create and maintain a package - e.g php-stubs/magento-stub
- and include your mocks?
from phpstan-magento.
@shochdoerfer Would you like me to create and maintain a package - e.g php-stubs/magento-stub - and include your mocks?
I don't see a benefit in that.
from phpstan-magento.
Related Issues (20)
- No coverage data is *not* sent to Coveralls
- Certain CI steps run several times without additional result HOT 1
- DateTimeFactory Issue; HOT 6
- Use Magento root for TestFrameworkAutoloader HOT 8
- Project config file at path app/code/Vendor/Module does not exist. HOT 5
- Factory generation misnames output class HOT 4
- Current release version not updated HOT 5
- Wrong directory used as "magentoRoot" when current working direcory is not magento root HOT 2
- private string $magentoRoot; not work in PHP 7.2 HOT 4
- Generated class ProductExtension is passed on incorrectly to phpstan HOT 30
- Missing Interface class HOT 9
- Add support for PHP 8.2 HOT 3
- Compatibility with PHPstan 1.10.x HOT 4
- Failure with `phpstan/phpstan-phpunit` and PHPStan cache usage HOT 19
- Version 0.30.0 fails with errors about unexpected items in parameters HOT 4
- Extend ci_neon_lint script to validate parametersSchema
- Incompatibility with phpstan & rector and 2.4.6 HOT 1
- Internal error: Class\Foo does not exist and has no extension interface in file class.php HOT 2
- Occasional Errors In Pipeline HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpstan-magento.