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

6623 Commits

Author SHA1 Message Date
Brown
27cb660377 Respect possibly-undefined array keys while merging
Fixes #3393
2020-05-19 20:10:01 -04:00
Brown
a4141a7581 Fix #3327 - convert void to null when comparing conditional type with nullable 2020-05-19 19:48:11 -04:00
Brown
742282bbb5 More config 2020-05-19 17:51:28 -04:00
Brown
30feaf3faa Improve Scrutinizer config 2020-05-19 17:43:50 -04:00
Brown
f335560b69 Allow setting property on templated type 2020-05-19 17:31:05 -04:00
Brown
6ec5763847 Filter out traversable possibly-mixed too 2020-05-19 16:26:00 -04:00
Brown
a3214012a6 Only convert userland functions 2020-05-19 16:15:41 -04:00
Brown
baeb86ca8f Fix #3403 - remove possibly-mixed key 2020-05-19 16:12:37 -04:00
Brown
4415e0f69c Fix special case calling callable param with string non-global function
Fixes #3411
2020-05-19 15:48:31 -04:00
Matthew Brown
777b6e8d91 Simplify conditional 2020-05-19 15:07:30 -04:00
Brown
b5ae0167a2 Fix typo 2020-05-19 14:58:53 -04:00
Brown
b38d945b12 Cast null and false to empty string
Ref #3408
2020-05-19 14:53:06 -04:00
Brown
8becefda04 Forbid :: in object-like key name
Ref #3399
2020-05-19 14:38:46 -04:00
Šimon Podlipský
dc82243edc
Add RdKafka:flush() to CallMap (#3410) 2020-05-19 12:56:58 -04:00
Brown
0b2da18f1e Break up StatementsAnalyzer 2020-05-19 12:56:30 -04:00
Joe Hoyle
588be3b269
Fix getSymbolInformation() for symbols containing ":" (#3400)
Currently a Symbol like `10-15:array{foo: string}` will return ` string}`, as the regex does not specify a string-start caret.
2020-05-19 10:15:13 -04:00
Šimon Podlipský
47cf69ded1
Fix RdKafka maps (#3404)
Resolves #3388
2020-05-19 10:13:25 -04:00
Brown
666cc3b4c9 Fix BinaryOp analysis 2020-05-18 23:00:53 -04:00
Brown
8e5b330c5a Break apart CallAnalyzer 2020-05-18 22:57:00 -04:00
Brown
5b06c206e0 Move classes into deeper namespace 2020-05-18 22:52:33 -04:00
Brown
ace049a068 Beautify BinaryOpAnalyzer 2020-05-18 18:57:09 -04:00
orklah
478bb267d8
stubs for array_sum (#3395) 2020-05-18 17:23:21 -04:00
Brown
3c5b4dec06 Add documentation for MixedClone 2020-05-18 17:20:57 -04:00
Brown
8c86d47eb7 Downgrade some PossiblyInvalidClone issues 2020-05-18 17:18:13 -04:00
Brown
4ca83ca30d Add slash 2020-05-18 17:05:47 -04:00
Brown
3a582dde8d Allow merging of numeric-string and literal string 2020-05-18 16:57:16 -04:00
Brown
2312523318 Support merging of numeric-string with literal 2020-05-18 16:56:09 -04:00
Brown
b62f646388 Fix #3391 - move_uploaded_file mutates 2020-05-18 16:26:08 -04:00
Evgeniy
04a576708c
Correct analyze clone expression (#3382)
* Correct analyze clone, add PossibleInvalidClone issue type

* Infer mixed type when possible incorrect clone

* Remove unused variable
2020-05-18 16:22:50 -04:00
feek
d60ece752c
chore: mark as lowercase string (#3392) 2020-05-18 16:02:46 -04:00
Brown
ea0a99d3a8 Fix bad merge 2020-05-18 16:02:10 -04:00
Brown
5ee1487a01 Make ExpressionAnalyzer more beautiful 2020-05-18 15:13:27 -04:00
SignpostMarv
911ac2d363
Infer numeric-string from (string)$numeric (#3390)
* adding test for vimeo/psalm#3370

* check if typecast will result in numeric-string

* int & float as per examples in vimeo/psalm#3370
* numeric & numeric-string because they shouldn't lose numericness.

* satisfy phpcs

* adjusting assertions to reflect typecasting change
2020-05-18 13:42:47 -04:00
Brown
21798efed2 Fix #3388 - eliminate null after < 0 check 2020-05-18 08:52:44 -04:00
Mark Sch
9aa46221f6
Use pretty print for JSON reporting. (#3364)
* Use pretty print for JSON reporting.

* Use pretty print for JSON reporting.

* Use pretty-print option on CLI for BC.

* Change static:: const to self::

Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-18 08:40:20 -04:00
orklah
3e7f5df7e1
Solve more cases when docblock rendering is not needed (#3387) 2020-05-18 07:16:18 -04:00
Matthew Brown
b0ffaf0077 Fix type coercion 2020-05-17 22:51:48 -04:00
Matthew Brown
3ecef8bee7 Fix #3386 - non-empty-array = non-empty-array<array-key, mixed> 2020-05-17 22:49:20 -04:00
RJ Garcia
fd15bfc65d
Infer Return Types for Arrow Functions #3376 (#3385)
* Infer Return Types for Arrow Functions #3376

- Made a small patch to check for closure or arrow
  function when attempting to infer the functions
  params
- Added new isExprClosureLike to start to consolidate
  all checks on closure/arrow fns

Signed-off-by: RJ Garcia <ragboyjr@icloud.com>

* Use better check

* Remove unused method

Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-17 22:17:35 -04:00
orklah
dd4927a14c
Avoid regenerating docblock when no modification is made (#3374)
* Avoid regenerating docblock when no modification is made

* Generate empty docblock before, in case there was no docblock at all
2020-05-16 16:44:47 -04:00
Jefersson Nathan
f824cc380a
Add more test case scenario for @psalm-import-type (#3375)
* Add test case scenario for @psalm-import-type

Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>

* Add fix for @psalm-import-type test

Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>

* Add test for import ocross namespaces

Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>

* Add tests for failing cases

Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
2020-05-16 16:43:35 -04:00
Matthew Brown
4dd0a2b775 Fix #3380 - allow comparisons between template param and empty array 2020-05-16 16:41:07 -04:00
Matthew Brown
f6342a40d9 Remove unnecesary conditional check for do
Fixes #3378
2020-05-16 16:32:36 -04:00
Nobu Funaki
abef8008bc
Fix InvalidCast after is_callable([$val, '__toString']) check (#3372)
Support is_callable() with an array argument similar to method_exists()
2020-05-16 08:50:43 -04:00
Brown
e7db21fd44 Fix type method 2020-05-15 16:23:50 -04:00
Brown
c62e08a88e Support intersection of type aliases 2020-05-15 16:18:52 -04:00
Brown
111303d913 Add non-empty-lowercase-string type 2020-05-15 10:18:05 -04:00
Brown
013467dc0e Add reference to ensure proper hydration 2020-05-15 00:31:55 -04:00
Brown
0086eb25a2 Remove duplicate types with @psalm-import-type 2020-05-15 00:16:20 -04:00
Brown
2d92943625 Add support for expansion of type aliases 2020-05-15 00:15:48 -04:00