Comments (5)
Hey @kkmuffme, can you reproduce the issue on https://psalm.dev ?
from psalm.
+1 on this, never really liked the naming of that method, it's too confusing
from psalm.
I got bitten a few times on this also. However, looping over a known single result array is really annoying IMHO (and arbitrarily access the first element of a possibly empty array is worse). I'd prefer deprecating or renaming isSingle to replace it with a correct check for single Atomic.
But seeing as you two contribute a loot more than I do these days (or months :D), I'll let you be the judge of what needs to be done!
from psalm.
Well the actual logic itself of the method may be sometimes useful, but the current name is positively awful, and I can't think of a proper one out of the box (isSingleAtomicOrSingleLiteralSupertype
? can't really think of anything).
Though a proper isSingleAtomic
method should still be provided, simply doing count($this->types) === 1
, and getSingleAtomic
is also useful in this sense, I see no reason to remove it.
from psalm.
I think "isSingle" is used more often than "getSingleAtomic" so deprecating that is less work :D
from psalm.
Related Issues (20)
- `if ($enum instanceof BackedEnum)` doesn't infer `BackedEnum` type HOT 1
- Support extended types `stdClass<type>` and `stdClass{foo:type}` HOT 2
- Psalm does not warn about uninitialized property when using mixed HOT 1
- match operator paradox HOT 1
- Unexpected `PossiblyNullPropertyFetch` after `$object?->property === %NOT_NULL%` HOT 1
- numeric-string status lost via rtrim HOT 9
- Disjointed array shape blocks non-empty-array HOT 4
- Conditional and types ? HOT 1
- InvalidArgument when using manually instantiated object of TValue in context of Class<TValue> HOT 4
- Null-safe usage within if condition asserts object ref is null HOT 1
- properties-of does not work with traits. HOT 3
- Match with true or false in subject expression needs redundant casting to bool HOT 3
- Pushing to a list element changes the type of the list to `non-empty-array` HOT 7
- Invalid RedundantCast when casting Stringable obj to string HOT 2
- Psalm errorBaseline config not respected when given paths HOT 4
- Support PHP 8.3 Override attribute HOT 4
- Signature / return types are lost when creating a closure from known callable string HOT 1
- Inferred array keys marked as optional when source referenced in try catch HOT 6
- CDATA used in baseline in a lot more cases than before PHP 8.1 HOT 4
- Test ignore
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 psalm.