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

8069 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
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
Marco Pivetta
0b5a828f6f
#4997 added more precise type inference for count() returning 0 or positive-int on known arrays (#4999)
* #4997 added more precise stub for `count()` returning `0` or `positive-int` on known types

* #4997 updated `count()` to support `\SimpleXmlElement` and `\ResourceBundle` counting, as well as handling hardcoded 2-element-arrays cases

This patch:

 * adds support for `count(\SimpleXmlElement)` (https://www.php.net/manual/en/simplexmlelement.count.php)
 * adds support for `count(\ResourceBundle)` (https://www.php.net/manual/en/resourcebundle.count.php)
 * removes usage of global constants from stub (not supported - see https://www.php.net/manual/en/function.count.php)
 * adds support for identifying fixed-element-count arrays, for example `count(callable&array)`, which is always `2`

* #4997 adapted `FunctionCallReturnTypeFetcher` to infer `TPositiveInt` for `count(TNonEmptyArray)` and `count(TNonEmptyList)`

* The `FunctionCallReturnTypeFetcher` is responsible for defining the precise type of a `\count(T)`
expression when given a `T`, so we baked the whole type resolution for `positive-int`, `0` and
`positive-int|0` directly in there.

While this complicates things, it is also true that it is not possible right now (for the stubs)
to provide the level of detail around `count()` that is required by the type inference system
for such a complex function with so many different semantics.
2021-01-29 11:47:31 +01:00
Matt Brown
2daa27548e
Improve treatment of strict equality 2021-01-29 11:47:31 +01:00
Matthew Brown
3dd3f3380b
Bump up to 8 concurrent builds 2021-01-29 11:47:31 +01:00
Matthew Brown
0c98b97163
So long Travis 2021-01-29 11:47:31 +01:00
Matt Brown
7665778b56
Simplify assertion when mixed 2021-01-29 11:47:31 +01:00
Ben Davies
d31dc663b9
Split unit test over multiple jobs in GitHub Actions, lowering the total run time (#4985)
* Split unit test over multiple jobs in GitHub Actions, lowering the total run time

* rename FileManipulationTest to FileManipulationTestCase so it does not run as a standalone Test
2021-01-29 11:47:31 +01:00
Matt Brown
25505b4b03
Fix #4976 - improve type narrowing 2021-01-29 11:47:31 +01:00
Matthew Brown
89188f378e
Limit to releases again 2021-01-29 11:47:30 +01:00
Matt Brown
d78ad13e30
Fix case for echo 2021-01-29 11:47:30 +01:00
Matthew Brown
a8f125e6ba
Fix signing 2021-01-29 11:47:30 +01:00
Matt Brown
b2db33b465
Try siginig again 2021-01-29 11:47:30 +01:00
Matt Brown
5f6d93d977
Use expliit key id 2021-01-29 11:47:30 +01:00
Matt Brown
443e968a0e
Maybe fix signing 2021-01-29 11:47:30 +01:00
Matt Brown
2df3454507
Don’t try to import local keys 2021-01-29 11:47:30 +01:00
Matthew Brown
e5c903f779
Change GPG key 2021-01-29 11:47:30 +01:00
Matthew Brown
fa638c3432
Also push signed phar for master commits 2021-01-29 11:47:30 +01:00
Bruce Weirdan
15b6957cee
Added GHA workflow to build phars (#4974) 2021-01-29 11:47:29 +01:00
Matt Brown
c2eba896a4
Fix #4982 - ensure destructuring assignments are seen inside a loop 2021-01-29 11:47:29 +01:00
Matt Brown
dfb82b8487
Fix #4955 - catch invalid passing class constant where templated class string expected 2021-01-29 11:47:29 +01:00
Bruce Weirdan
398f5f9970
Allow Attribute::IS_REPEATABLE (#4971)
This allows Attribute::IS_REPEATABLE to be specified as attribute flag.

Fixes vimeo/psalm#4892, vimeo/psalm#4970
2021-01-29 11:47:29 +01:00
Matt Brown
c6e09db4ff
Add non-emptiness check 2021-01-29 11:47:29 +01:00