Giter VIP home page Giter VIP logo

Comments (4)

schmittjoh avatar schmittjoh commented on July 17, 2024

I'm not sure I understand the fix you propose?

from scrutinizer.

chalasr avatar chalasr commented on July 17, 2024

I don't looked at the code for now so I can't give a real proposal ATM (I'll investigate as you seem to confirm the bug).

But, the problem is there is a check preventing the error that the patch is trying to prevent, and this check is not considered.
Do you see a way to look for a return (or any breaking statement) that would prevent the method to be called with an invalid argument and so make this patch not helpful?

The @param false|array has nothing to do with the real issue, I removed it from the description.
As I never worked on this code until here, it would be nice if you have a suggestion.

from scrutinizer.

schmittjoh avatar schmittjoh commented on July 17, 2024

There is a difference between

/** @param boolean|string $x */
function($x) {
  if ( ! $x) {
     return;
  }

  // $x is still boolean|string here, since it could be true
}

and

/** @param false|string $x */
function($x) {
  if ( ! $x) {
     return;
  }

  // $x is just string here, since false is excluded by if
}

If I understand correctly, you have the first case in your code. I don't see how we can make the analysis smarter in that case though. If I'm missing something, please let me know.

from scrutinizer.

chalasr avatar chalasr commented on July 17, 2024

Yes, you got it.

And sure, there is nothing to do. I think that I would have liked to have a patch for the inverse side, saying that if @x can be only false because it cannot be true and is not checked for true in the method, the doc should be @param false|string and not bool|string.

Overkill (or impossible), I close this.
Thank's for your time.

from scrutinizer.

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.