Add @psalm-* annotations for better static analysis (compatible with PHPStan too)#97
Conversation
2c7dc72 to
bf98faa
Compare
|
Hi, good point, I actually added I'm curious about |
|
An example that comes to mind would be indexing an array of Brick objects (let's say a LocalDate) by their ISO strings. If I have a function Or if you have a method that expects some kind of "identifier", which could have invariants making sure it's not empty. Sorry if it's not the most amazing use cases I'm thinking of right now, but that's something. ;) |
|
Indeed that could make sense here. And it doesn't hurt ;-) Thanks for the example! |
|
Please rebase to fix CS and I'll merge this! 👍 Edit: looks like |
Missing @psalm-return non-empty-string on LocalDateRange
bf98faa to
fe52b56
Compare
|
Thank you, @gnutix! |
Below are the two types improvements I've noticed were missing when we've integrated the library in our application. I've not read every code signature to make sure everything was as precise as it could be though, so maybe other type improvements will come in the future.
TODO
@return non-empty-stringontoStringmethods (and alike)@return -1|0|1oncompareTomethods