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
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
Bruce Weirdan
394f7347de
Add missing dataflow population in array spreads ( #5059 )
...
Fixes vimeo/psalm#5057
2021-01-29 11:47:34 +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
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
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
Matt Brown
d81d57a30e
Fix #5029 - remember staticness of types when combining
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
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
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
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
Matt Brown
99da1daae5
Fix #4958 - honour template as inheritance when comparing template types
2021-01-29 11:47:29 +01:00
Matt Brown
387abc1cb6
Fix #4943
...
Prevent input types becoming part of the inferred generic params when a match is found
2021-01-29 11:47:29 +01:00
Adrien LUCAS
fe71e8d16b
Trigger dispatch even when only legacy hooks ( #4962 )
2021-01-29 11:47:28 +01:00
Adrien LUCAS
f9cbc07fb7
Avoid false positives for taint specialized calls even when not using a variable ( #4948 )
2021-01-29 11:47:28 +01:00
Matt Brown
4c5c32bc93
Fix #4945 - use assertion string for scalar templated assertions
2021-01-29 11:47:28 +01:00
orklah
31be6212b7
add stubs for standard iterators ( #4725 )
...
* add stubs for standard iterators
* Apply suggestions from code review cc @weirdan
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
* complete stub + delete code made redundant by stubs + fix some syntax in stubs
* fix parse error
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-01-29 11:47:28 +01:00
Adrien LUCAS
63ddceaf8e
Taint specialized calls even when not using a variable ( #4940 )
2021-01-29 11:47:27 +01:00
Matt Brown
e67315424f
Fix #4917 - allow array_reduce to be called with a single arg
2021-01-29 11:47:27 +01:00
orklah
c2c25ada84
add ArrayAccess to SimpleXmlElement ( #4934 )
...
* add ArrayAccess to SimpleXmlElement
* add test
2021-01-29 11:47:27 +01:00
orklah
d8fea8aabb
implement DTO for plugins ( #4881 )
...
* implement DTO for plugins
* introduce EventHandler + reintroduce legacy API for plugins
2021-01-29 11:47:27 +01:00
orklah
a17e403270
handle concatenation with int parts ( #4938 )
2021-01-29 11:47:27 +01:00
Matthew Brown
8696873cb9
Break out parent and implemented class checks
2021-01-29 11:47:26 +01:00
orklah
e949ed68ac
Infer result of modulo 1 operation statically ( #4926 )
2021-01-29 11:47:25 +01:00
Lukas Bestle
c58f5603c3
SARIF report: Include help links ( #4924 )
2021-01-29 11:47:25 +01:00
Lukas Bestle
0355465b38
Full support for $this
in @var
annotations ( #4922 )
...
Fixes #4916 .
2021-01-29 11:47:25 +01:00
Matthew Brown
7142c53f18
Fix test
2021-01-29 11:47:24 +01:00
Matthew Brown
3322ffb3f0
Fix #4912 - detect mismatching property type
2021-01-29 11:47:24 +01:00
Matthew Brown
ba823602ea
Fix #4901 - simplify mapping of template types within class
2021-01-29 11:47:23 +01:00
orklah
a475b23f0b
fix phpdoc ( #4905 )
2021-01-29 11:47:23 +01:00
orklah
bc900b2dd6
Document lowercase-string when possible ( #4904 )
...
* document lowercase-string
* fix missing strtolower
2021-01-29 11:47:22 +01:00
orklah
25e022e77e
Illegal offset ( #4865 )
...
* Illegal offset access
* add tests
* fix tests
2021-01-29 11:47:22 +01:00
Fran Moreno
7ddec46e76
Allow by reference parameters in method docblock ( #4873 )
2021-01-29 11:47:22 +01:00
Bruce Weirdan
0b2081b621
Allow assertions on static class properties ( #4833 )
...
* Minimal implementation for assertions on static properties
* Added inheritance tests
* Add support for `ClassName::$var`
* Import strpos() to keep phpcs happy
* Add support for conditional assertions on static properties
2021-01-29 11:47:21 +01:00
Matt Brown
8f192801c1
Prevent mixed array offset in array creation
...
Fixes #4846
2021-01-29 11:47:21 +01:00
Matt Brown
cbf7e596f7
Fix #4827 - don’t eradicate double after int check
2021-01-29 11:47:20 +01:00
Matt Brown
4416da85e7
Fix #4837 - bind correct static class when checking mixin types
2021-01-29 11:47:20 +01:00
Matt Brown
cc06cb53f5
Fix #4839 - undefined possibly set in by-reference should be treated as such
2021-01-29 11:47:20 +01:00
Matt Brown
1f295e4597
Fix psl inheritance stuff cc @azjezz
2021-01-29 11:47:20 +01:00