1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

8245 Commits

Author SHA1 Message Date
Bruce Weirdan
97fe86c4e1
Fix BC break introduced in 4.6.3 (#5410)
Fixes vimeo/psalm#5405

Requires new patch release.

This PR reverts changes to the signature of `IssueBuffer::finish()` and
introduces separate method to be used to capture `$_SERVER`
2021-03-16 19:28:18 -04:00
Matt Brown
9d979e3467 Fix #5406 - track more changes to assertion type 2021-03-16 16:33:09 -04:00
orklah
2777b62d0b
String can be reconciled with Scalar (#5402) 2021-03-16 13:46:23 -04:00
orklah
1149050817
adapt bcdiv for PHP8 in stubs (#5401) 2021-03-16 13:45:54 -04:00
orklah
ff5a6cb297
iterator_to_array must always return array-key (#5400) 2021-03-16 13:45:34 -04:00
orklah
1a3ff5676a
fix stub for array_combine + remove false in PHP8 + improve tests (#5395) 2021-03-16 13:43:49 -04:00
AndrolGenhald
9d840ee87b
Disable property invariance checks for properties with templates (#5380)
* Disable property invariance checks for templates

Property invariance checks were already disabled for template
properties, this also disabled the checks for arrays, lists,
class-string-maps, and iterables that contain templates.

Partially fixes #5371

* CS fixes

* Fix and simplify hasTemplate.

Add hasTemplate to TypeNode and simplify implementation with getChildNodes.

* Revert hasTemplate change and add containsTemplate.

* Check class-string too.
2021-03-16 13:43:30 -04:00
Theodore Brown
5b9efd579d
Fix type of DomElement childNodes property (#5403)
Partially addresses #5291
2021-03-16 13:42:05 -04:00
Bruce Weirdan
ae247d09a3
Don't mark promoted properties as unused params (#5404)
If anything, they should be marked as unused properties.

Fixes vimeo/psalm#4964
2021-03-16 13:41:43 -04:00
Matt Brown
817d1cf3fe Fix #5408 - avoid nullref when parser param cannot be found 2021-03-16 13:40:16 -04:00
orklah
dd4d970a37
makes array_combine return non-empty-array for most cases (#5393)
* makes array_combine return non-empty-array for most cases

* Add back newline

Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-14 21:18:19 -04:00
Matt Brown
f1a840727d Improve min/max return type cc @orklah
Type::combineUnionTypes preserves metadata for union types, and is more accurate
2021-03-13 19:28:24 -05:00
Matt Brown
b549989ba7 Prevent overwriting storage type during analysis 2021-03-13 14:12:55 -05:00
orklah
90fd1c5d1f
fix usage of callable with array_map (#5373) 2021-03-12 14:05:22 -05:00
orklah
57234ab243
fix int overflow (#5369) 2021-03-12 14:04:08 -05:00
orklah
cddef00692
fix int overflow (#5369) 2021-03-12 13:24:00 -05:00
Andrii Dembitskyi
38171934cf
Fix anchor to class-string type in documentation (#5362) 2021-03-11 00:14:57 -05:00
Bruce Weirdan
205fdd197e
Wrap entrypoints into IIFE to protect their variables (#5366)
* Wrap entrypoints into IIFE to protect their variables

Fixes vimeo/psalm#5359

* Add tests for Psalm variable isolation

* Capture environment before registering autoloader
2021-03-11 00:14:22 -05:00
orklah
0a4ad5733b
add stubs for min/max (#5353) 2021-03-11 00:13:17 -05:00
Simon Podlipsky
9793f92ba1
Mark ceil() return type as float (#5355)
https://www.php.net/manual/en/function.ceil.php

The return value of ceil() is still of type float as the value range of float is usually bigger than that of int.
2021-03-11 00:11:32 -05:00
Junaid Farooq
5066377271
Remove duplicate entry for 'amphp/amp' from composer.json file (#5352)
Removes the duplicate entry for 'amphp/amp'  from the require-dev section of _composer.json_ file.
Updates the entry in the require section to the latest version used earlier.
2021-03-11 00:10:23 -05:00
Bruce Weirdan
4f8ba04236
Provide more specific explode() return type (#5350)
Fixes vimeo/psalm#5347

`explode()` now omits `false` from the return type  when separator is a
definitely non-empty string.
2021-03-11 00:09:15 -05:00
Bruce Weirdan
8be77aaa2e
Track variable usage in bool to int casts (#5349)
Fixes vimeo/psalm#4956
2021-03-11 00:08:32 -05:00
Bruce Weirdan
185827a7ab
Continue analysis after unknown exception being caught (#5348)
Fixes vimeo/psalm#5188
2021-03-11 00:08:02 -05:00
Bruce Weirdan
71a0457284
Emit ImplicitToStringCast in more places (#5344)
* Emit ImplicitToStringCast in more places

Fixes vimeo/psalm#5320

`to_string_cast` is set on successful comparison, thus it needs to
always bubble up (it will be ignored in UnionTypeComparator if some part
does not match).

* Fix implicit casts

* Fix handling of string method references in self-out context
2021-03-11 00:07:39 -05:00
Bruce Weirdan
7138678c63
Allow undefined variable detection in arrow functions (#5343)
Previously Psalm would assume that any variable it sees in the arrow
function body is defined (and mixed, if it's not available in the outer
scope). This prevented undefined variable detection. Dropping that
assumption allows it to work.

Fixes vimeo/psalm#5331
2021-03-11 00:06:23 -05:00
Markus Staab
5747f1df14
docs: mention default level (#5340)
* docs: mention default level

* Update error_levels.md
2021-03-11 00:06:02 -05:00
Gregor Harlan
c606c89006
config.xsd: fix default errorLevel (#5339) 2021-03-11 00:05:23 -05:00
Claas Augner
3c66b755e2
Always return type inference summary, even if no files were analyzed due to caching (#5329)
* Fix #5319 – Always return type inference summary

Even if no files were analyzed (e.g. due to caching).

* fix code style
2021-03-06 17:20:01 -05:00
Bruce Weirdan
65f0fb0288
Allow multiple version-dependent method stubs (#5337)
Fixed vimeo/psalm#4836
2021-03-06 17:18:51 -05:00
Matt Brown
c97ee5ccdb Fix #5258 - allow ReflectionParameeter::hasType() to inform getType() return 2021-03-06 16:54:23 -05:00
Matt Brown
ca331f5afa Consolidate assertion sanitisation 2021-03-06 16:43:11 -05:00
Matt Brown
c05a3ea073 Break up CoreGenericClasses 2021-03-06 16:05:14 -05:00
Bruce Weirdan
beca4a127f
Suppress test issues with Symony functions used with ::class constant (#5335)
These appeared in symfony/symfony#40203
2021-03-06 15:29:15 -05:00
Matt Brown
96e0743892 Fix #5325 – remove all memoised methods when calling a method with property mutations 2021-03-05 00:39:25 -05:00
Erik Booij
7793d4bec0
Update mysql_connect_error() return type definition (#5323) 2021-03-05 00:09:00 -05:00
Sergei Morozov
9bde1d9107
Fix PDOStatement::fetchAll() return type (#5317) 2021-03-05 00:08:42 -05:00
Matt Brown
4c65d3b424 Fix #5310 - allow iterable coercion from generic object 2021-03-03 00:13:00 -05:00
Bruce Weirdan
a284933c43
Be even less quiet about git errors (#5309) 2021-03-02 22:25:37 -05:00
Bruce Weirdan
841efbdfaf
Make WeakMap generic (#5313) 2021-03-02 22:25:19 -05:00
Sergei Morozov
594ef4fdbf
Fix mysqli_init() return type (#5306) 2021-03-01 22:50:11 -05:00
Bruce Weirdan
217b49a8a8
Fix suppressed phar build error (#5304)
This fixes the log noise due to `cp` syntax error. Possibly it will also
cause phar signatures to be available on `psalm/phar`.
2021-03-01 22:49:52 -05:00
Ilija Tovilo
27e7fb554a
Fix gd CallMap for PHP 8 (#5271) 2021-03-01 11:23:45 -05:00
404db2bb1a
Fix JSON reports with long UTF8 strings (#5300)
* Fix JSON reports with long UTF8 strings

* CS fix

* UTF8-safe snippets
2021-03-01 11:23:21 -05:00
Matthew Brown
ad8c04ce17
Add section about verifiable docblocks 2021-03-01 00:14:24 -05:00
Matthew Brown
1c6a966e40
Remove heading for non-existent annotation 2021-03-01 00:03:59 -05:00
Matt Brown
f5ed12f038 Fix tests by removing references 2021-02-28 23:58:21 -05:00
Matthew Brown
3e3a44b479
Update philosophy.md 2021-02-28 15:09:19 -05:00
Matthew Brown
a1be12886e
More thoughts 2021-02-28 14:57:49 -05:00
Matthew Brown
21742497d6
Add header 2021-02-28 14:49:53 -05:00