Giter Site home page Giter Site logo

Comments (5)

theofidry avatar theofidry commented on June 2, 2024 2

If you execute it with --only-covered do you still encounter the problem?

from infection.

maks-rafalko avatar maks-rafalko commented on June 2, 2024 1

Please see this workaround #1894 (comment) - you can disable mutation of attributes for now.

from infection.

niconoe- avatar niconoe- commented on June 2, 2024 1

Symfony/Doctrine mutators are a good idea for a good usage of them, I definitly agree about it, but the mutations on PHP Attributes are more global than just them: in my example, I used a custom PHP Attribute, not a Symfony/Doctrine or whatever library's from.

I'm not sure I'm valuable in front of Sebastian Bergmann to tell him that PHP Attributes must be covered 😅 but I really do think it should be on coverage side: like I said, PHP Attributes are impacting runtime behaviors, they're not just definitions. And I guess that as soon as coverage will tell you PHP Attributes are (or not) covered instead of being ignored, PHP Infection will automatically be ready to handle them. That's why I'm convinced it should be an enhancement on CodeCoverage's side.

from infection.

niconoe- avatar niconoe- commented on June 2, 2024

Thanks for your answers.

@maks-rafalko Thank you for the proposal to ignore via RegExp, but I'm using a forced global configuration file for PHP Infection across multiple projects to ensure they have the exact same standards quality, and I don't want to have some specific project ignorance here, I'm looking for a solution I can use globally. Nevertheless, that's good to know, and if I need that, I'll keep in mind!

@theofidry Using --only-covered works like a charm! I'll add this to ignore all uncovered snippets on all my projects as I'm already checking the code coverage directly via PHPUnit's reports. I'll use your solution then.

I don't know if you guys want to get further on this, as the proposed solutions are only about ignoring PHP Attributes, but IMO, it makes perfect sense to mutate them and give it a try, as they have a direct impact on runtime. Is there any ideas or actions you got to make them declared as covered or something? or do you think it should be on PHP's CodeCoverage to stop ignoring them?

Thanks a lot again and have a good day!

from infection.

maks-rafalko avatar maks-rafalko commented on June 2, 2024

We didn't think a lot through it and didn't discuss it yet, but I agree - it would be very nice to mutate attributes properly, with coverage supported.

I had an idea to create symfony/doctrine related mutators to

  • change validation rules
  • remove validation rules
  • change doctrine mappings
  • etc.

Regarding where the issue is - on CodeCoverage or Infection side - I don't know, needs to be investigated. So any help would be appreciated :)


If it won't be supported on CodeCoverage side, the only one way I see is to do the same as we do for parameters: as soon as the method is executed - its attributes are "executed" as well, so are treated as covered. And we can get this information from the phpunit's reports we are using.

from infection.

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.