Comments (1)
I agree these should be reported on the same level but I steer more towards level 7. My reasoning: level 5 is about types that are definitely wrong, like string
passed into int
. So level 5 is about "proving incorrectness".
But string
passed into class-string
or literal-string
might be wrong. Because the string
might actually be literal-string
or class-string
. And level 7 is about these "maybes", thanks to checkUnionTypes: true
and reportMaybes: true
.
The reason why is this currently inconsistent is because literal-string
is implemented as an AccessoryType, meaning literal-string
is actually an IntersectionType of StringType and AccessoryLiteralStringType. But class-string
is just a single class called ClassStringType.
As I always point out in issues like these is that you should be aware that unless you're on the highest level, you're always missing out on potential errors :) Personally I feel quite safe on level 8, level 9 is too brutal for me. But level 7 will definitely show a lot of useful errors when compared to level 5.
from phpstan.
Related Issues (20)
- Order of docblocks and attributes might need to mentioned in the docs? HOT 1
- Error reported using static create method with generics HOT 2
- Array count in match results in incorrect offset error in lower branch of match HOT 3
- Call to an undefined static method ReflectionMethod::createFromMethodName() HOT 6
- Strict comparison using PPP between XXX and YYY will always evaluate to false. HOT 2
- Array is not considered equal to itself if it contains NANs HOT 2
- Variable X in isset() always exists and is not nullable for any array item HOT 1
- Multiple interfaces not supported HOT 2
- sprintf with only literal-string should return literal-string HOT 3
- array_change_key_case() is not reported to return different case keys
- Unary operation on string results in error HOT 2
- Generic trait: type of a method parameter in an abstract method is not specified HOT 1
- Inconsistent results with/out result–cache HOT 3
- @phpstan-import-type only works on classes, not functions or methods HOT 2
- `match` on `count(...)` could narrow array type HOT 1
- Narrowing types when using instanceof HOT 1
- PHP 8.2: Partially-supported callable are deprecated HOT 3
- Larave11 makes parsing large Enum files considerably slower. HOT 15
- While-true: Specific type is forgotten HOT 1
- BackedEnum type checking HOT 1
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.