Git Product home page Git Product logo

Comments (5)

mergeable avatar mergeable commented on June 3, 2024

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

from phpstan.

ondrejmirtes avatar ondrejmirtes commented on June 3, 2024

Please reproduce the issue with a minimal code snippet.

from phpstan.

gabebruno avatar gabebruno commented on June 3, 2024

My file has PHP and HTML in the same file, trying to reduce the code and testing, I managed to get to this minimum piece of code to analyze.

https://phpstan.org/r/1b2b6ea3-65d6-4ba1-8a6e-bf82a013b137

Apparently the problem is in the constant() method, because removing the method, the file will run succesfully.

Edit: Doing some tests here, I found another information about the problem, the method only causes problems if used with a variable.

Edit2: another file having the constant($variable) method used don't show any errors, it's just with this specific code snippet.

from phpstan.

ondrejmirtes avatar ondrejmirtes commented on June 3, 2024

So there's a case where your code runs with constant('')? What's the purpose?

from phpstan.

gabebruno avatar gabebruno commented on June 3, 2024

It's not exactly on purpose, it's legacy code with a lot of old and incorrect implementations, I figured PHPStan would mention the problem to fix it, but this is breaking PHPStan itself.
If it's not a valid issue, that's fine, but I think it will be a good source of answers for others facing the same problem.

The code was much larger, this is just a small part of the code to reproduce the error. This $sysERR variable can be changed in the middle of the code, so it is not exactly empty, the empty is just the first initialization of the variable and even then PHPStan is breaking.

from phpstan.

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.