1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
Commit Graph

187 Commits

Author SHA1 Message Date
orklah
c9129b5c4c
only transform a Keyed array into callable-array if there's two elements (#5086)
* only transform a Keyed array into callable-array if there's two elements in array

* add tests
2021-01-29 11:47:35 +01:00
Matt Brown
0c52f528bd
Fix #5049 - assertion of !empty on bool makes true 2021-01-29 11:47:33 +01:00
Matt Brown
27a5323277
Unset should change array with keyed offsets 2021-01-29 11:47:31 +01:00
Matt Brown
25505b4b03
Fix #4976 - improve type narrowing 2021-01-29 11:47:31 +01:00
Lukas Bestle
0355465b38
Full support for $this in @var annotations (#4922)
Fixes #4916.
2021-01-29 11:47:25 +01:00
Matt Brown
cfe2e81629
Fix #4791 - only generate special has-array-key assertions for unknown key types 2021-01-29 11:47:18 +01:00
Matt Brown
5e4bece7d3
Fix #4802 - don’t clone context when analysing coalesce 2021-01-29 11:47:17 +01:00
orklah
48f55f3c3b
Allow int casts if the type comes from calculation (#4768) 2021-01-29 11:47:14 +01:00
Matt Brown
9c5cc02f90
Fix #4759 – don’t generate assertion when assigning to same-named variable 2021-01-29 11:47:13 +01:00
Matt Brown
1780541501
Ref #4753 - allow int literals to inform key type 2021-01-29 11:47:12 +01:00
Matt Brown
c54416090f
Don’t suggest a potential value that’s undefined
Fixes #4754
2021-01-29 11:47:12 +01:00
Matt Brown
f8e22ab7ac
Break out array_key_exists tests 2021-01-29 11:47:12 +01:00
Matt Brown
b1996262ba
Ensure that strict empty handling always happens 2021-01-29 11:47:11 +01:00
Matt Brown
2d1222ddec
Fix assertions on unions 2021-01-29 11:47:11 +01:00
Matt Brown
d6b98f2afe
Fix null array access complaints 2021-01-29 11:47:11 +01:00
Matt Brown
06d69ba5f3
Break out RedundantCast issues 2021-01-29 11:47:10 +01:00
Matt Brown
024bbef5cd
Fix #4743 - simplify assertions generated from array_key_exists check 2021-01-29 11:47:09 +01:00
Matthew Brown
cbd8150fde
Add RedundantPropertyInitializationCheck (#4732)
* Add RedundantPropertyInitializationCheck

* add documentation for RedundantPropertyInitializationCheck (#4734)

Co-authored-by: orklah <orklah@users.noreply.github.com>
2021-01-29 11:47:05 +01:00
Matt Brown
5cf5aecb2f
Fix #3017 - use correct keys when converting list to array 2021-01-29 11:47:04 +01:00
orklah
45d058c2dd
better fix for reconciling iterable and object (#4712) 2021-01-29 11:46:27 +01:00
Matt Brown
9539c0f27f
Fix generic ArrayAccess creation cc @orklah 2021-01-29 11:46:27 +01:00
orklah
1966766a79
Allow reconciling between object and iterable (#4706)
* Allow reconciling between object and iterable

* add tests
2021-01-29 11:46:27 +01:00
Matt Brown
033a209950
Treat $a ?? $b identically to isset($a) ? $a : $b 2021-01-29 11:46:26 +01:00
Matt Brown
5228ff6369
Fix #4699 - treat isset like !== null when variable is defined 2021-01-29 11:46:26 +01:00
orklah
005373bbc2
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2021-01-29 11:46:25 +01:00
Matt Brown
e5f25c7780
Add support for some dependent types 2021-01-29 11:46:25 +01:00
Matt Brown
068907327d
Fix #4637 - prevent regression when negating function call with === false 2021-01-29 11:46:18 +01:00
Matt Brown
3b3239635b
Fix #4626 - array_key_exists should infer type for first arg where possible 2021-01-29 11:46:16 +01:00
Matt Brown
7b4f0745f5
Simplify assertion negations, centralising as much as possible
Now the flag passed to scrapeAssertions just determines the errors emitted
2021-01-29 11:46:16 +01:00
Matt Brown
6f9be03789
Revert "Fix #4624 - allow in_array to work with list arrays"
This reverts commit 08ae85a735.
2021-01-29 11:46:16 +01:00
Matt Brown
191f305aec
Fix #4624 - allow in_array to work with list arrays 2021-01-29 11:46:15 +01:00
Matt Brown
36af6d70d2
Fix tests 2021-01-29 11:46:05 +01:00
Matt Brown
fb5e30850a
Fix #4503 - don’t ignore assertions on possibly-null mixed 2021-01-29 11:46:05 +01:00
Matt Brown
578e65820a
Ensure we flush out re-assigned vars also referenced
Fixes #4488
2021-01-29 11:46:04 +01:00
Matt Brown
57cd29ee9d
Put assignment-in-conditional tests in their own file 2021-01-29 11:46:04 +01:00
Matt Brown
8b44459c7c
Fix overeager inference 2021-01-29 11:45:02 +01:00
Matt Brown
e440baf671
Improve algebra handling a little better 2021-01-29 11:44:33 +01:00
Matt Brown
eef4ea018b
Empty checks variables are really falsy checks 2021-01-29 11:44:31 +01:00
Matt Brown
a57d62b71b
Add logic to weed out unnecessary clauses 2021-01-29 11:44:30 +01:00
Matt Brown
7df404bfb5
Fix #4374 - prevent paradox and allow Psalm to understand more assignments in conditionals 2021-01-29 11:41:13 +01:00
Matt Brown
481cf84b94
Don’t overwrite true flag 2021-01-29 11:39:58 +01:00
Matt Brown
74d6f166c1
Be more explicit about negation 2021-01-29 11:39:58 +01:00
Matt Brown
8043683f26
Ignore just-coerced vars 2021-01-29 11:39:58 +01:00
Matt Brown
596811cdc1
Suppress errors from fake statements 2021-01-29 11:39:58 +01:00
Matt Brown
c5c177a80a
Improve binary op || analysis for chain 2021-01-29 11:39:57 +01:00
Matt Brown
596e71d6aa
Unskip now-working tests 2021-01-29 11:39:57 +01:00
Matt Brown
2d8d1b9bf7
Fix #4354 - allow assignments on RHS of || in if conditional 2021-01-29 11:39:57 +01:00
Matt Brown
da79106a6a
Fix #4349 - improve types for suggested unions 2021-01-29 11:39:57 +01:00
Matt Brown
4f60d2dd4d
Fix #4347 - fix combinatorial expansion when negating if conditions 2021-01-29 11:39:56 +01:00
Matt Brown
0f8b017384
Prevent features pre-php-8 2021-01-29 11:39:54 +01:00