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

8353 Commits

Author SHA1 Message Date
Matt Brown
642f2f435c Fix #5640 - improve handling of assignments in conditional 2021-04-18 16:16:54 -04:00
Matt Brown
bb0bfda7c5 Improve mic drop variable name 2021-04-18 15:50:50 -04:00
Matt Brown
0acc02e184 Use more descriptive names for properties & variables of if/else handling 2021-04-18 15:38:12 -04:00
Alessandro Lai
ee778e9246
Allow Xdebug handler 2.0 (#5633) 2021-04-16 16:07:47 -04:00
Alexander Makarov
ff00255c19
Fix excluding binary path under Windows (#5628)
* Fix excluding binary path under Windows

* Fix CS
2021-04-15 06:55:45 -04:00
Bruce Weirdan
93946d0827
Forbid rejecting named arguments when parent allows them (#5627)
Fixes vimeo/psalm#5622
2021-04-15 06:55:13 -04:00
Matthew Brown
93e9054f98
Remove collections 2021-04-13 00:02:01 -04:00
Matthew Brown
e505cd58b4
Add use 2021-04-12 23:52:50 -04:00
Jacob Dreesen
5777c00073
Add missing opening PHP tag in the docs (#5617)
* Add missing opening PHP tag in the docs

* Fix typo
2021-04-12 23:50:52 -04:00
Matt Brown
f874740c83 Fix phpcs 2021-04-10 22:01:07 -04:00
Matt Brown
b7f122425f Use proper variable 2021-04-10 21:48:50 -04:00
Abdul Malik Ikhsan
2a31b66978
Add json_last_error to impure function (#5613)
* Add json_last_error to impure function

* add 'json_encode', 'json_decode' as well

* revert json_encode and json_decode
2021-04-10 20:38:02 -04:00
Matt Brown
012dafad79 Fix #5383 - prevent unsound use of new static for generics 2021-04-10 13:16:19 -04:00
orklah
bb88cff28a
Int and Float can be reconciled with Numeric (#5611) 2021-04-09 23:59:59 -04:00
3b3065c881
Allow variable keys with array_key_exists (#5606)
* Allow variable keys with array_key_exists

* Switch to elseif
2021-04-09 11:29:45 -04:00
AndrolGenhald
9f0d13998f
Fix race condition creating parser cache directory (fixes #4483) (#5603)
I wasn't able to reproduce the error under normal conditions, but I set a
breakpoint on the `mkdir` call, created the directory, then continued, and it
seems to handle it correctly.
2021-04-09 11:29:09 -04:00
AndrolGenhald
518d0af895
Strict int/float comparison for conditional types, improve range return type (#5601) 2021-04-09 11:28:48 -04:00
orklah
5f4a21190f
Numeric can be Falsy (#5598) 2021-04-07 22:02:13 -04:00
AndrolGenhald
870c433dc2
Check oldest ancestor for protected method visibility (fixes #5595) (#5597) 2021-04-07 22:01:41 -04:00
AndrolGenhald
9a03598a6d
Improve type resolution of class constants. (#5591)
Handle array plus operator (fixes #5588).
Handle array spread operator.
Improve string concatenation to resolve to literal instead of unknown string.

I feel like it should be possible to let ConstantTypeResolver take advantage of
the better type analysis in ArrayAnalyzer, ConcatAnalyzer, etc, but it would
require a restructuring that's beyond me for the time being.
2021-04-07 21:56:35 -04:00
Matt Brown
a469c82653 Fix #5587 - detect final class calls when routed through parent 2021-04-06 12:35:09 -04:00
ccf4c91688
The return value of generator methods can potentially be null (#5577)
* The return value of generator methods can potentially be null

* Add @psalm-ignore-nullable-return
2021-04-06 11:28:39 -04:00
Matt Brown
7080bc3bff Fix #5578 - variables always set in conditionals should be combined 2021-04-06 11:11:40 -04:00
Valentin Udaltsov
6851b5c1f1
Added TValue template to PDOStatement stub (#5579) 2021-04-05 18:20:59 -04:00
Matt Brown
517b2030c9 Fix #5545 - throwing uses method 2021-04-04 21:17:12 -04:00
Bruce Weirdan
f07b6e675e
Support array of objects in array_column() (#5567)
Fixes vimeo/psalm#5460
2021-04-04 00:01:01 -04:00
Bruce Weirdan
34cb21c7fc
Report cases where object is coerced into object with properties (#5566)
Fixes vimeo/psalm#5565
2021-04-04 00:00:31 -04:00
Bruce Weirdan
4a8e94444f
Prevent concurrent phar pushes (#5563)
Fixes vimeo/psalm#5346
2021-04-03 23:59:40 -04:00
Bruce Weirdan
106c7db5d1
Provide more detailed return type for get_object_vars() (#5557)
Handle keyed objects and named objects, including support for property
visibility.
2021-04-02 15:39:43 -04:00
Valentin Udaltsov
31096d9361
Marked iterator_to_array as an impure function (#5532) 2021-04-02 15:38:15 -04:00
AndrolGenhald
d022910599
ConcatAnalyzer improvements and non-falsy-string fixes. (#5544)
* ConcatAnalyzer improvements.

Deduplicate code.
Improve type inference.
Allow literal type inference when only one side has multiple types (fixes #5483).
Fix invalid type inference with negative int as right operand.

* Fix inference to be lowercase-string when concatenating int.

* Fix TNonEmptyLowercaseString to not be subtype of TNonFalsyString.

'0' is a non-empty-lowercase-string that is falsy.

* Fix other issues with non-falsy-string.

* Nest ands and ors

Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-31 23:16:21 -04:00
Matt Brown
fe97aa0722 Fix #5542 - nullsafe method calls are assumed used 2021-03-31 10:08:52 -04:00
Matt Brown
150dd00060 Fix #5540 - function is used inside throw expression 2021-03-31 10:03:25 -04:00
Valentin Udaltsov
59b7de5647
Closes #3238 Marked flock as an impure function (#5543) 2021-03-31 09:55:36 -04:00
Matt Brown
ece138562f Fix too-long line 2021-03-30 18:39:51 -04:00
Bruce Weirdan
cd002e6a87
Do not consider isset checks on static properties as redundant (#5525)
* Do not consider isset checks on static properties as redundant

Unlike normal properties, static properties do not have a prescribed
initialization sequence, so they can always be uninitialized (or unset).
Thus `isset()` checks on them are never redundant.

Fixes vimeo/psalm#5489

* Fix issue with nullable is_static
2021-03-30 11:56:08 -04:00
Martin Gold
667568d925
Double directory separator on "Cannot resolve stubfile path" (#5509)
* fix: double directory separator on invalid stubfile path

* fix: non-existing stubfile error message
2021-03-30 11:55:33 -04:00
Bruce Weirdan
8753c28a1b
Marked more functions as impure (#5524)
Fixes vimeo/psalm#5519
2021-03-30 11:55:09 -04:00
Saif Eddin Gmati
931a4b44f1
typo (#5523) 2021-03-30 11:54:22 -04:00
AndrolGenhald
3ce41d71a4
Clean up issues list, add documentation to help with named variadic confusion. (#5511)
* Clean up issues list, add documentation to help with named variadic confusion.

* Add ComplexFunction and ComplexMethod back to issues list.

I removed them because the documentation files don't exist, but they're used and the documentation just needs to be added.
2021-03-29 15:10:49 -04:00
Bruce Weirdan
6bd7f5b867
Forbid template annotation on closures (#5499)
They don't work properly anyway.

Fixes vimeo/psalm#5472
2021-03-29 15:10:04 -04:00
orklah
adc5368b97
fix Int overflow for pow (#5510) 2021-03-29 15:09:44 -04:00
Matt Brown
150e35f782 Add config file 2021-03-29 15:09:14 -04:00
Matt Brown
17e147935a Fix #5506 – make array_values and iterator_to_array respect nested templates 2021-03-29 09:37:51 -04:00
Bruce Weirdan
d57dde0d15
Allow phantom classes in instanceof expression (#5498)
Fixes vimeo/psalm#5481
2021-03-29 00:11:45 -04:00
Matt Brown
d4377c0baf Check upper bound too 2021-03-28 23:54:38 -04:00
Matt Brown
2d197e3e12 Allow older composer/semver cc @xurizaemon 2021-03-28 23:45:52 -04:00
Bruce Weirdan
ec7de89f0c
Do not let string subtypes subsume class-strings (#5497)
Previously, Psalm would treat unions like `class-string|numeric-string`
as `numeric-string`, while the only case when string should subsume
`class-string` is when we're combining `class-string` with non-specific
`string`.

Fixes vimeo/psalm#5491
2021-03-28 23:12:23 -04:00
Matt Brown
9a714b759e Fix #5496 - ensure params extended in properties are properly fleshed out 2021-03-28 23:10:38 -04:00
Matt Brown
f41deeab0a Taint through reset call 2021-03-28 13:14:35 -04:00