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

8045 Commits

Author SHA1 Message Date
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
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
Bruce Weirdan
9ce329c866
Skip conditional includes when registering autoload files (#4967)
This should allow analysis of forward-compatible polyfills used in
codebases targeting older PHP versions.

The following previously problematic polyfills should now emit no parse
errors:

* `symfony/polyfill-ctype`
* `symfony/polyfill-intl-grapheme`
* `symfony/polyfill-intl-normalizer`
* `symfony/polyfill-mbstring`

The pattern that is now works as intended looks like this:
```php
if (\PHP_VERSION_ID >= 80000) {
    require __DIR__ . '/bootstrap80.php';
    return;
}
```

Previously Psalm would scan the required file even when codebase
targeted older PHP versions, and would emit parse errors when that file
contained PHP 8 syntax.

Fixes #4961 and #4965
2021-01-29 11:47:29 +01:00
Bruce Weirdan
d9999b575d
Removed misc files from dist archives (#4968) 2021-01-29 11:47:28 +01:00
Adrien LUCAS
fe71e8d16b
Trigger dispatch even when only legacy hooks (#4962) 2021-01-29 11:47:28 +01:00
Bruce Weirdan
7b43d321ad
Correct gzread signature (#4960)
Fixes vimeo/psalm#4959
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
Matthew Brown
77975167a7
Fix #4951 - add Traversable interface to PDOStatement 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
orklah
e99cf5f514
adds statements list in the event (#4835) 2021-01-29 11:47:28 +01:00
orklah
7f4550a889
pass args through event (#4864) 2021-01-29 11:47:27 +01:00
Matthew Brown
f46583d9d1
Update language_server.md 2021-01-29 11:47:27 +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
1d6338e13b
Add comments to AtomicMethodCallAnalyzer and suppress ComplexMethod 2021-01-29 11:47:27 +01:00
Matthew Brown
257f67d593
Break apart type combiner 2021-01-29 11:47:26 +01:00
Matthew Brown
237520eafc
Break out large chunk to simplify function 2021-01-29 11:47:26 +01:00
Matthew Brown
8696873cb9
Break out parent and implemented class checks 2021-01-29 11:47:26 +01:00
Matthew Brown
affaa5ea85
Uncomment erroneously-commented return 2021-01-29 11:47:26 +01:00
Matthew Brown
f00a53efd5
Break out large chunk 2021-01-29 11:47:26 +01:00