Comments (5)
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
from phpstan.
Please reproduce the issue with a minimal code snippet.
from phpstan.
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.
So there's a case where your code runs with constant('')
? What's the purpose?
from phpstan.
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)
- Count after calling SplObjectStorage::removeAll
- Stub validation does not work in an extension HOT 4
- False positive on stream_get_meta_data HOT 4
- Incorrect `\Imagick::identifyImage()` return type HOT 2
- Incorrect expression is always false when using numeric-string array keys HOT 2
- Internal error: Internal error: PhpParser\ParserAbstract::parse(): Argument #1 ($code) must be of type string, false given, called in HOT 3
- 1.10.67 release introduced wrong date format return type HOT 5
- PHP RFC: Deprecate implicitly nullable parameter types HOT 1
- str_getcsv return type sanitization ignored HOT 1
- Applying type-modifying function conditionally drops type info
- param-immediately-invoked-callable should be usable for parameters with a Closure type HOT 1
- Proper usage of the callable lifetime tags should be enforced in static analysis HOT 1
- Setting property in anonymous function is ignored by if.alwaysFalse
- Offset numeric-string does not exist on array<string, ...> HOT 4
- Report possible invocations of destructors as throw points and impure points
- Add a way to ignore/override a stub from an extension HOT 7
- Override nullable to non-nullable parameter in constructor should be detected in PHPStan. HOT 3
- "Variable might not be defined" when always assigning variable in match arm HOT 3
- empty constructor of final class should be pure HOT 1
- PHPDoc tag @var for constant with type string|null is not subtype of native type string HOT 2
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 phpstan.