1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 12:24:49 +01:00
Commit Graph

8090 Commits

Author SHA1 Message Date
yaegassy
9e41905171
docs: Update config of vim-lsp in language_server.md (#5117) 2021-01-29 11:47:38 +01:00
Matt Brown
08e305cbea
Fix #4010 – don’t create interface intersections unless there’s no overlap 2021-01-29 11:47:37 +01:00
Matt Brown
051169f9f2
Fix #5097 - memoise more things during null coalesce 2021-01-29 11:47:37 +01:00
Matt Brown
5a0e9d0965
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-29 11:47:37 +01:00
Joe Hoyle
cdc431e940
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-29 11:47:37 +01:00
Matt Brown
037b24550f
Fix #5099 - use class constant for default 2021-01-29 11:47:37 +01:00
Matt Brown
43170a84a9
Prevent infinite loop while scanning in some situations 2021-01-29 11:47:37 +01:00
Matt Brown
4627065d1f
Fix #5108 - prevent crash on 0 type 2021-01-29 11:47:37 +01:00
Matt Brown
5da816f160
Ensure getId() output can always be parsed as a type
Ref #5105
2021-01-29 11:47:36 +01:00
Matthew Brown
aaa912374f
Remove ProxyManager run 2021-01-29 11:47:36 +01:00
sji
6426da6269
Fix wrong comments in CallMap_80_delta.php (#5104) 2021-01-29 11:47:36 +01:00
sji
7569e17d06
Bump the CURRENT PHP TARGET VERSION to 8.0 in CallMap.php (#5103) 2021-01-29 11:47:36 +01:00
sji
995f89e8b9
Fix CallMap of PDOStatement for PHP8 (#5100)
The definitions are based on the php-src stub. 4bbb98c24f/ext/pdo/pdo_stmt.stub.php
2021-01-29 11:47:36 +01:00
Oliver Hader
ae54b72dba
Update documentation for taints and global configuration (#5098)
* [DOCS] Extend documentation on global variables configuration

* [DOCS] Synchronize meaning of @psalm-taint-source input with source code

* [DOCS] Add documentation for conditional @psalm-taint-escape

* [DOCS] Add documentation for @psalm-taint-unescape
2021-01-29 11:47:35 +01:00
Matt Brown
cf9d8f08b9
Removing proxymanager from test-with-real-projects for the time being 2021-01-29 11:47:35 +01:00
Matt Brown
569af4aaae
Fix composer location 2021-01-29 11:47:35 +01:00
Matt Brown
e4ec434759
Add intl extension for composer install 2021-01-29 11:47:35 +01:00
Matt Brown
a1a4fae7cb
Fix long line 2021-01-29 11:47:35 +01:00
Bruce Weirdan
9292316073
Remove ReflectionType::getName(), move ReflectionType::isBuiltin() (#5090)
* Remove ReflectionType::getName(), move ReflectionType::isBuiltin()

* `ReflectionType::getName()` was never there: https://3v4l.org/1iZt4
* `ReflectionType::isBuiltin()` was moved to
`ReflectionNamedType::isBuiltin()` in PHP 8

Fixes vimeo/psalm#5089

* Fix test

* Mark test as php 8.0 only
2021-01-29 11:47:35 +01:00
Bruce Weirdan
0aa4f2044c
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-29 11:47:35 +01:00
Joe Hoyle
ed9043b43c
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-29 11:47:35 +01:00
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
Joe Hoyle
c837535c9d
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-29 11:47:34 +01:00
Adrien LUCAS
6c0b2f8cb9
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-29 11:47:34 +01:00
Matt Brown
99148f4d99
Make complex method break the build 2021-01-29 11:47:34 +01:00
Matt Brown
2004f8aadb
Fix #5070 – fix static return type inference in static methods 2021-01-29 11:47:34 +01:00
Matthew Brown
822464cbaf
Fix #5078 - when unpacking with missing array item, Use the param’s default type if param has one 2021-01-29 11:47:34 +01:00
Bruce Weirdan
2b39ab02a0
Resolve class aliases when accessing properties (#5068)
* Resolve class aliases when accessing properties

* Moved Properties::getClasslikeStorage() to ClassLikes::getStorageFor()
2021-01-29 11:47:34 +01:00
Vincent Langlet
df5b3418b0
Catch InvalidArgumentException (#5061) 2021-01-29 11:47:34 +01:00
Bruce Weirdan
394f7347de
Add missing dataflow population in array spreads (#5059)
Fixes vimeo/psalm#5057
2021-01-29 11:47:34 +01:00
orklah
a9235b6ee9
fix wrong order of types (#5058) 2021-01-29 11:47:33 +01:00
ec901d2e44
Check iterator types on yield from (#5042)
* Check iterator types on yield from

* Switch to NodeAbstract

* Make Foo iterable
2021-01-29 11:47:33 +01:00
orklah
5eb4d88f1a
add createFromInterface in PHP 8 (#5055) 2021-01-29 11:47:33 +01:00
Bruce Weirdan
204582be52
Use composer autoloader during init (#5054)
Fixes vimeo/psalm#5048

The issue was caused by missing dependency of a class that Psalm tried
to inspect through reflection. Fixed by using composer autoloader which
avoids the need to use reflection.
2021-01-29 11:47:33 +01:00
Matt Brown
0c52f528bd
Fix #5049 - assertion of !empty on bool makes true 2021-01-29 11:47:33 +01:00
Matt Brown
5e75140ca5
Fix #5020 - remove previous catch var assertions when assigning inside catch 2021-01-29 11:47:33 +01:00
Matt Brown
75d1f79a3d
Fix #5017 - handle combining literal and non-empty strings 2021-01-29 11:47:33 +01:00
Matt Brown
0107afb2fb
Fix #5025 - prevent crash in assert function during reflection 2021-01-29 11:47:33 +01:00
Matt Brown
245b944c85
Fix #5028 - avoid false-positive on dynamic property fetch after ternary 2021-01-29 11:47:33 +01:00
Lukas Bestle
eb3c014106
Stubs: Don't explicitly depend on \Stringable (#5037)
Fixes #5007.
2021-01-29 11:47:32 +01:00
orklah
61b7975850
Calculate more literal values (#5032)
* try to calculate more literal values

* add test

* improve test
2021-01-29 11:47:32 +01:00
orklah
2a682c1f36
use coherent annotations (#5031) 2021-01-29 11:47:32 +01:00
Matt Brown
d81d57a30e
Fix #5029 - remember staticness of types when combining 2021-01-29 11:47:32 +01:00
Daniele Santini
b71ff1109a
Add codeclimate.json report (#5030) 2021-01-29 11:47:32 +01:00
Matt Brown
2fbfc429b7
Only create after analysis event if they exist
Fixes #5008 - this does some git execing, so we don’t want it to always run
2021-01-29 11:47:32 +01:00
orklah
8954c12eaa
don't throw InvalidArrayOffset when dealing with templates (#5019) 2021-01-29 11:47:32 +01:00
orklah
d56f941303
remove signature return types in stubs (#5014)
* remove return types from signatures for some stubs

* fix duplicate type
2021-01-29 11:47:32 +01:00
Thomas Bley
0e2e8fb321
fix #5010 function exec() is disabled (#5012)
* fix #5010 function exec() is disabled

* Improve error message

Co-authored-by: Thomas Bley <thomas.bley@bringmeister.de>
Co-authored-by: Matthew Brown <github@muglug.com>
2021-01-29 11:47:32 +01:00
Matt Brown
27a5323277
Unset should change array with keyed offsets 2021-01-29 11:47:31 +01:00
Matt Brown
bd8df0e820
Fix #5001 - update variables after context after type change from empty
Empty is the invalid state, and some old logic here was causing a bug
2021-01-29 11:47:31 +01:00