Comments (3)
but perhaps I'm missing something, maybe reflection is also used.
Yes :) It uses parses the AST of the source code and may leverage reflection for some mutations. It could be delegated to BetterReflection at some point, but not sure what the performance impact would be.
from infection.
Hi!
I would like to be able to use it with Infection, too.
I think it's a bad idea in the current state of things. As you noted, infection need to autoload your code. So if you install it in a different composer.json
(which is what bamarni/composer-bin-plugin
does), then you can end up with various issues:
- The same class is declared in both infection (or its dependencies) and your project: in this case the second declaration will not be loaded (and their implementation may differ, PHP will just see "this class has been loaded already" and won't load it again).
- Same with functions, in which case if they don't have the
if (!function_exists(...))
which you will end up with declaring twice a function which crashes PHP.
Using Infection PHAR would be no different if it was a regular PHAR. However Infection uses PHP-Scoper to address those issues.
As the main contributor and a heavy user of bamarni/composer-bin-plugin
, I totally understand the concern of wanting to isolate tools dependencies. However, I think this approach cannot be systematic due to the reasons outlined above. To be able to do so, you need either a tool that doesn't autoload your code, or a tool for which its code is scoped (like Infection PHAR, or like the phpstan package which ships the scoped PHPStan PHAR).
A possible solution however, would be to do like PHPStan, i.e. have a proxy package which ships the isolated PHAR. I do not know how that works with extensions though, IIRC PHPStan managed to get around with it, I do not know what it entails for Infection.
from infection.
Thank you for the fast and detailed answer!
Of course, if Infection needs to autoload project dependencies, it makes it impossible to use it with composer-bin-plugin
and I'll have to switch to PHAR version; thanks to PHP-Scoper, it's possible.
But I still don't completely understand why Infection needs to load project's dependencies. I thought that it uses PHPUnit CLI to run tests and PHP-Parser to parse sources; but perhaps I'm missing something, maybe reflection is also used. Anyway, the tool is great and helps a lot.
from infection.
Related Issues (20)
- Checking fail if config not in root directory (testFramework=codeception)
- Add new GitLab (Code Climate) code quality JSON logger.
- Release tag shows incorrect version HOT 2
- MulEqual with -1 cannot be fixed HOT 3
- Disable PHP Attribute mutations globally via config. HOT 2
- Attribute is removed when `public` is mutated to `protected`
- Incorrect --filter with PHPUnit 10 HOT 10
- E2E tests fails HOT 5
- Infection reports mutations on impossible to cover parts: PHP Attributes HOT 5
- Uncaught TypeError: PhpParser\Lexer\Emulative::__construct(): Argument #1 ($phpVersion) must be of type ?PhpParser\PhpVersion, array given HOT 4
- Alternative Badge SVG File as report for use in Gitlab and private Repositories HOT 9
- nikic/php-parser 5 support HOT 3
- Clean project ApiPlatform + PhpUnit 11 + PHP 8.3.x -> nikic/php-parser minimum version bump needed HOT 3
- Upgrade `php-cs-fixer` and add more rules
- Randomly failing test HOT 2
- Gitlab logger errors when run outside git repository HOT 2
- GPG key expired HOT 3
- Excluded sources are being processed for mutation
- Mutations should be skipped base on individual time, not total time HOT 9
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 infection.