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

Add SQL / DQL mutators #1699

Open
Slamdunk opened this issue Jun 20, 2022 · 1 comment
Open

Add SQL / DQL mutators #1699

Slamdunk opened this issue Jun 20, 2022 · 1 comment

Comments

@Slamdunk
Copy link
Contributor

Hi, given the raise of static analysis tools that can interpret both DQL (phpstan-doctrine) and SQL (phpstan-dba) I wonder if and how we can introduce mutators also for queries.

The main mutators I'm looking for to challenge queries in PR are:

  1. Boolean Substitution
  2. Negated Conditionals

There are a lot of considerations to take into account:

  • How to we know a string is a SQL / DQL?
  • Do we need to rely on external tools like the above mentioned static analyzer?
  • Should this be an Infection extension rather than a new feature?
  • How this copes with --git-diff-lines?
@maks-rafalko
Copy link
Member

maks-rafalko commented Jun 20, 2022

I had this idea for ages (framework/lib-specific mutators), so a big 👍 here.

If (when) we go with extracting our mutators to a separate package (#669), this can be just a "plugin" / repo with doctrine-related mutators. For now it's easier to integrate it as a profile/standard mutators into Infection core, IMO.

How to we know a string is a SQL / DQL?
Do we need to rely on external tools like the above mentioned static analyzer?

I don't know how difficult it will be, we touched it a couple of times, Ondrej suggested to integrate PHPStan's analyzer here #697 (comment). Seems like not an easy task from the first glance, keeping in mind possible performance implication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants