Barney Laurance
509aadc08a
Remove all (but one) properity declarations that needed NonInvariantDocblockPropertyType suppressed ( #5174 )
...
The remaining property
\Psalm\Internal\Analyzer\NamespaceAnalyzer::$source seems a bit harder
to fix
2021-02-08 09:36:42 -05:00
Matt Brown
876a772edc
Fix #5176 - substitute in actual argument when instance type found
2021-02-08 09:29:41 -05:00
Matt Brown
3be1bb7342
Limited fix for #5028
2021-02-07 22:56:37 -05:00
Bruce Weirdan
e3d73a3166
Allow suppressing thrown interfaces and their descendants ( #5178 )
...
Fixes vimeo/psalm#5177
2021-02-07 21:08:29 -05:00
Matt Brown
3bf7a73c61
Simplify TypeExpander::expandAtomic
2021-02-07 13:14:26 -05:00
Matt Brown
649d1f6ad6
Don’t recursively expand generic types
2021-02-07 11:31:42 -05:00
Matt Brown
8b5e0fc754
Fix #5172 - prevent calling function with implicitly-broader type
2021-02-07 11:07:22 -05:00
Matt Brown
5e2d252edb
Fix invariance checks
2021-02-07 01:58:03 -05:00
Matt Brown
4d76f7545c
Allow property type invariance on templated properties
...
This is a bit of a hack – the comparison should be similar to the ones done in MethodComparator, but this avoids false-positives for now
2021-02-07 01:45:48 -05:00
Matt Brown
049b2c3f7a
Prevent check triggering for commonly-extended classes
2021-02-07 01:24:08 -05:00
Matt Brown
f2d202e2bb
Add less severe issue for docblock property type invariance cc @bdsl
...
This is less likely to break everything
2021-02-07 00:52:29 -05:00
Bruce Weirdan
04bb2b1182
Prevent invalid Traversable implementation ( #5171 )
...
* Prevent invalid Traversable implementation
Fixes vimeo/psalm#5167
* Document new issue
* CS fix
2021-02-06 22:10:05 -05:00
Bruce Weirdan
b72c5a0fa2
Mark variables in throw arguments as used ( #5166 )
...
Fixes vimeo/psalm#5164
2021-02-06 22:07:01 -05:00
Saif Eddin Gmati
d740c1679c
allow libraries to provide psalm plugins ( #5165 )
2021-02-06 22:06:00 -05:00
orklah
343d020408
improve psalter capacities for anonymous class extending real classes ( #5146 )
2021-02-04 09:59:38 -05:00
Matt Brown
ff325b3e70
Fix #5141 - combine numeric-string and non-empty-string to non-empty-string
2021-02-03 17:40:41 -05:00
Matt Brown
a0420fb704
Add non-falsy-string to allow more accurate checks
2021-02-03 17:19:48 -05:00
Matt Brown
03665b9646
Revert "Correct Psalm’s concept of string emptiness"
...
This reverts commit 331ce8ead4
.
It was too hasty
2021-02-03 01:09:58 -05:00
Matt Brown
331ce8ead4
Correct Psalm’s concept of string emptiness
...
It contrasted with PHP’s idea
2021-02-02 23:07:51 -05:00
Matt Brown
7dbdc8c59e
Fix #5144 - prevent exception during taint analysis
2021-02-02 14:16:15 -05:00
Matt Brown
0eed186edf
Fix #5140 - always replace closure return types, whether or not a matching input type is present
2021-02-01 21:40:30 -05:00
Matt Brown
0f2a07a9a3
Fix #5137 – support @psalm-flow in methods
2021-01-31 22:40:48 -05:00
Matt Brown
c1d868f950
Fix #5127 - delay transformation of base classes based on inheritance until later
2021-01-31 12:33:07 -05:00
Barney Laurance
0cd5442c47
Enforce property type invariance ( #5131 )
...
* Implement NonInvariantChildProperty detection
See https://github.com/vimeo/psalm/issues/4184
* Delete test cases with 'parentSetsWiderTypeInConstructor'
As I understand it these are not valid test cases. They
emit NonInvariantPropertyType issues which seems correct - the property
type variation is I think a latent bug in the sample code.
* Reduce shortcode for NonInvariantPropertyType to 1+max used shortcode on master
2021-01-31 11:32:24 -05:00
Joe Hoyle
a3dcc52e9a
Track references on global variables ( #5122 )
...
* Track references on global variables
Add global type references to the type map, and fix up unused detection on global variables.
* Add null assertions
* PHPCS
2021-01-28 18:58:02 -05:00
Joe Hoyle
5759472168
Add constant fetch to reference map ( #5115 )
...
* Add constant fetch to reference map
To support showing constant types on hover of constant references, we need to add them to the ref map.
* Fix root constants
* PHPCBF
2021-01-28 11:18:28 -05:00
Matt Brown
359a0166e3
Fix #4631 - prevent reusing named params
2021-01-27 22:53:55 -05:00
Matt Brown
4807d38507
Fix using std library functions
2021-01-27 22:28:33 -05:00
Matt Brown
dd11e541a7
Fix #4010 – don’t create interface intersections unless there’s no overlap
2021-01-27 12:48:32 -05:00
Matt Brown
3c58220f3a
Fix #5097 - memoise more things during null coalesce
2021-01-26 23:10:57 -05:00
Matt Brown
76269658ca
Fix #5107 - treat function-bound templated parameters the same
...
Previously they were treated differently depending on whether or not they were inside a method
2021-01-26 22:43:42 -05:00
Joe Hoyle
c946242683
Completions for array keys and type literals ( #5105 )
...
* Add completions for known array keys
* Use dynamic gap value
* Provide completions for known type contexts
* Fix formatting
* Remove trailing comma
* PHPCS fixes
* Remove support for literal floats
* Fix test for floats
2021-01-26 21:34:46 -05:00
Matt Brown
15e87b13b8
Prevent infinite loop while scanning in some situations
2021-01-26 15:51:15 -05:00
Matt Brown
62a5a74640
Fix #5108 - prevent crash on 0 type
2021-01-26 14:06:43 -05:00
Matt Brown
0624098865
Ensure getId() output can always be parsed as a type
...
Ref #5105
2021-01-25 23:41:51 -05:00
Matt Brown
dc7ffe2810
Fix long line
2021-01-24 14:02:55 -05:00
Bruce Weirdan
0489dd1fd8
Use separate exit code to indicate Psalm finding issues ( #5087 )
...
* Use separate exit code to indicate Psalm finding issues
This will allow to distinguish successful run that found some issues
from crashes.
* Fix e2e test expectations
* Documented exit statuses
2021-01-24 13:30:35 -05:00
Joe Hoyle
531cd36767
Support completions on class references ( #5085 )
...
* Support compleitions on class references
This provides completions on class references (as opposed to initiated objects via the type map), so you can do `MyClass::` and get completitions for static methods and constants etc.
* Only provide completions for references that don't exist
2021-01-24 13:29:21 -05:00
orklah
b61831345c
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-22 16:14:29 -05:00
Joe Hoyle
ba43e6d0f3
Remove file map cache when re-analyzing files ( #5084 )
...
* Remove file map cache when re-analyzing files
When the project is re-analyzed under the single thread condition (not using a process pool), the filemaps are not cleared before re-analyzing files. This means that file maps only get appended to. If you delete the contents of a file via the LSP, the file map will still be populated with all the old values for example.
In doing this I had to write a few more tests to check my assumptions too, so adding those additional tests.
* Rename test
* Formatting
* Formatting again!
2021-01-22 16:05:28 -05:00
Adrien LUCAS
6f1f680b2d
Add option to dump taint graph ( #5080 )
...
* Add option to dump taint graph
* Fix types
* Simplify types
Co-authored-by: Matthew Brown <github@muglug.com>
2021-01-22 16:04:15 -05:00
Matt Brown
6f30399189
Fix #5070 – fix static return type inference in static methods
2021-01-22 09:58:09 -05:00
Matthew Brown
28d2795e59
Fix #5078 - when unpacking with missing array item, Use the param’s default type if param has one
2021-01-22 00:20:51 -05:00
Bruce Weirdan
d659957b88
Resolve class aliases when accessing properties ( #5068 )
...
* Resolve class aliases when accessing properties
* Moved Properties::getClasslikeStorage() to ClassLikes::getStorageFor()
2021-01-21 19:38:17 -05:00
Vincent Langlet
c912b6c2b9
Catch InvalidArgumentException ( #5061 )
2021-01-20 17:42:45 -05:00
Bruce Weirdan
d296c4bb9a
Add missing dataflow population in array spreads ( #5059 )
...
Fixes vimeo/psalm#5057
2021-01-20 17:42:11 -05:00
81b75a7884
Check iterator types on yield from ( #5042 )
...
* Check iterator types on yield from
* Switch to NodeAbstract
* Make Foo iterable
2021-01-20 17:41:15 -05:00
Matt Brown
f1107ab4d9
Fix #5049 - assertion of !empty
on bool makes true
2021-01-19 17:19:47 -05:00
Matt Brown
2f58c6afc8
Fix #5020 - remove previous catch var assertions when assigning inside catch
2021-01-17 14:28:28 -05:00
Matt Brown
bca58863ad
Fix #5017 - handle combining literal and non-empty strings
2021-01-17 12:22:29 -05:00