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

2652 Commits

Author SHA1 Message Date
andrew
0456ef82a5 Prevent callable arg type enhancement for simple callable 2023-04-06 10:43:50 +03:00
andrew
d190b751fb Cleanup HighOrderFunctionArgHandler 2023-04-05 18:10:21 +03:00
adrew
a3aed2fc61 Analyse const callable like first-class-callable 2023-04-04 22:17:17 +03:00
orklah
f78bf32417
Merge pull request #9570 from klimick/first-class-callable-contextual-inference
Contextual inference for first-class-callable
2023-03-28 20:40:04 +02:00
orklah
6ca2f090d6
Merge pull request #9534 from fluffycondor/php8-str-function-signatures
Improve PHP8 str_* function signatures
2023-03-27 21:00:33 +02:00
andrew
2b5faaa02f Fix psalm errors 2023-03-27 18:37:11 +03:00
andrew
72e5709ef2 Handle partially templated first-class-callables 2023-03-27 18:29:22 +03:00
adrew
62a79eeff3 Test with invalid first-class-callable 2023-03-26 22:47:17 +03:00
adrew
f26c16d2ab Contextually resolve templates of first-class-callable arg during call 2023-03-26 19:07:20 +03:00
Bruce Weirdan
2a84a63483
Prevent assertion leaks from else
Fixes vimeo/psalm#9395
2023-03-18 02:09:56 -04:00
fluffycondor
9730f2c073 Don't report InvalidLiteralArgument for paths 2023-03-18 00:05:44 +06:00
Evan Shaw
ce3f7fccd6 Set inside_call for eval expressions 2023-03-15 22:06:36 +13:00
Bruce Weirdan
4042036e8e
Drop misleading type 2023-03-12 20:12:19 -04:00
Bruce Weirdan
30369e826a
Correctly handle near-overflowing keys and flag autoincrement overflows
Co-authored-by: Maximilian Krög <maxi_kroeg@web.de>
2023-03-12 19:57:14 -04:00
Bruce Weirdan
0e9085f3e0
Handle overflow in SimpleTypeInferer as well 2023-03-12 17:47:42 -04:00
Bruce Weirdan
103aa019da
Fix integer overflow in array keys
Fixes vimeo/psalm#9498
2023-03-12 16:20:13 -04:00
Bruce Weirdan
193a0dbe0e
Don't crash on unary minus overflow
Fixes vimeo/psalm#9464
2023-03-07 12:29:40 -04:00
Paweł Tomulik
78e6545d7f
fix #4460 2023-02-28 11:38:47 +01:00
ebakulin
67d26d3c51 added case with literal string 2023-02-28 00:22:34 +07:00
ebakulin
cf35b3ce0c reworked one known operand case 2023-02-28 00:12:18 +07:00
ebakulin
31fcbd5f69 added case with one null type 2023-02-27 22:03:01 +07:00
Evan Shaw
f7eaa5daec Preserve PossiblyUndefinedVariable when fixing UnusedVariable 2023-02-25 20:08:01 +13:00
Bruce Weirdan
2315c98a73
Merge pull request #9381 from weirdan/enforce-literal-string-length-limit 2023-02-23 16:47:53 -04:00
Yannick Gottschalk
f026226aa3 Fixes #9384 2023-02-23 17:23:46 +01:00
Bruce Weirdan
5dec7f3dc3
Enforce literal string length limit
Fixes vimeo/psalm#9376

Ensures:
* that we never have a literal string exceeding the length limit
* that we call string interpreter for all literal strings
2023-02-23 04:01:29 -04:00
Bruce Weirdan
d0a14005a8
Merge pull request #9380 from weirdan/array-in-foreach-is-not-empty 2023-02-23 02:20:46 -04:00
Bruce Weirdan
1769f8b9a4
Refine arrays in foreach loops to non-empty-array
Fixes vimeo/psalm#9378
2023-02-22 20:44:50 -04:00
Javier Sanahuja
aee3665014 Fixes 2023-02-22 23:55:27 +01:00
Javier Sanahuja
fa39366cb4 Code style fix 2023-02-22 23:19:47 +01:00
Javier Sanahuja
4f83324a91 Support sizeof alias of count 2023-02-22 23:11:10 +01:00
f665e719fb
Describe changes 2023-02-21 15:44:18 +01:00
575da79801 Fix #9363 2023-02-21 10:09:58 +01:00
Bruce Weirdan
ac86981a79
Revert "#7387 Add asserting non-empty-string by strlen"
This reverts commit 0ef7ec100a.
2023-02-20 23:07:22 -04:00
88a3d288de Workaround arm64 opcache bug (fixes #9350) 2023-02-20 12:49:59 +01:00
Bruce Weirdan
73bad8967d
Forbid first-class callables in new
It's an invalid construct in PHP, not rejected by PHPParser for some
reaason.

Fixes vimeo/psalm#9335
2023-02-19 04:18:32 -04:00
Evan Shaw
c8393bd50d Fix language server first-class callable crashes 2023-02-19 14:18:17 +13:00
Bruce Weirdan
ee823619b8
Flag direct constructor calls
Fixes vimeo/psalm#2975
2023-02-15 20:14:00 -04:00
Bruce Weirdan
8c491e93e8
Flag class constant references where LHS is ordinary string
Fixes vimeo/psalm#2185
2023-02-15 02:57:00 -04:00
Bruce Weirdan
3f2ecaec7e
Allow @var annotations on global vars
The actual code was extracted from `StaticAnalyzer`

Fixes vimeo/psalm#1111
2023-02-15 01:20:03 -04:00
Bruce Weirdan
39c992c255
Emit issues for calls to is_a(string, class-string, false)
Fixes vimeo/psalm#4092
2023-02-14 02:25:46 -04:00
Andrew Boyton
5d976900d1 Fix divide by a floating point zero
The code was failing when dividing by 0.0.
2023-02-09 11:55:06 +11:00
Bruce Weirdan
3c4a829f71
Fixed more CS issues 2023-02-07 11:20:02 -04:00
Matthew Brown
d450b40da8
Remove some logic that didn't need to be there (#9209)
* Remove check to see what breaks

* Simplify following logic

* Add tests from @kkmuffme‘s branch

* Reduce scope of fix

* Clean up logic a little

* Add failing test

* Improvements

* Fix for non-Paradoxical Condition result
2023-02-03 21:08:16 -05:00
Matt Brown
234787bcd6 Fix logic bugs caught by better elseif checks 2023-02-03 00:30:42 -05:00
orklah
54cd529642
Merge pull request #9170 from mmcev106/filter-var-pure
Added @psalm-pure to filter_var()
2023-02-02 23:39:06 +01:00
Bruce Weirdan
fb65c79079
Fix newly discovered CS issues 2023-02-02 12:19:22 -04:00
Mark McEver
77ea545244 Attempted to avoid a psalm warning that was not accurate 2023-02-01 15:50:36 -06:00
Mark McEver
b5781c34e8 Fixed a case where the conditional taint, specialize, & flow features were not playing nicely together 2023-02-01 15:41:52 -06:00
Leo Viezens
7966fd574a
Merge branch 'master' into master 2023-01-30 15:38:29 +01:00
Anner Visser
d86fcf4a85
Narrow ->value of enum case(s) to only the possible values
Using $stmt_var_type to determine if we're dealing with a subset of the
enum cases. If so, we only consider those cases for the possible values.

Fixes #8568
Fixes #8812
2023-01-21 12:05:24 +01:00