1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00
Commit Graph

7376 Commits

Author SHA1 Message Date
ygottschalk
5b0c9b1a28
added array-size max constraint to greater check (#4175)
added a few unit tests
2020-09-12 16:13:13 -04:00
Brown
09d22cb05c Fix #4169 - add appropriate bounds check 2020-09-12 11:33:26 -04:00
Claas Augner
3f8c91a64e
fix(docs): add missing issues to error levels (#4171) 2020-09-12 11:25:41 -04:00
Toshiyuki Goto
ad437c5265
Workaround to PhpScoper group use bug in Box (#4174) 2020-09-12 11:24:40 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Lexidor Digital
43d91665c6
[easy fix] Update example for @no-named-arguments (#4170)
The text mentions `@no-named-arguments`, but the example shows `@no-named-params`.
`@no-named-params` can not be found in the psalm source.
Updated example to `@no-named-arguments`.
[https://github.com/vimeo/psalm/search?q=no-named-params&unscoped_q=no-named-params](search for no-named-params) 1 result (this example)
[https://github.com/vimeo/psalm/search?q=no-named-arguments&unscoped_q=no-named-arguments](search for no-named-arguments) 2 results (this example and in CommentAnalyzer.php)
2020-09-11 23:36:10 -04:00
Adrien LUCAS
107f596f24
Document Xdebug usage (#4164)
* Document Xdebug usage

* Change to non-persistent approache

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2020-09-11 23:35:37 -04:00
Brown
6d8641ac09 Fix documentation 2020-09-10 22:58:26 -04:00
Brown
6ffe471525 Make new InvalidLiteralArgument issue for strpos refs
Ref #4070
2020-09-10 22:54:32 -04:00
Brown
eda426a594 Improve unique issue solution 2020-09-10 22:54:30 -04:00
Brown
00ad09816f Fix tests 2020-09-10 19:05:47 -04:00
Brown
aaede393d4 Fix #4070 - prevent literal strpos argument 2020-09-10 18:28:34 -04:00
Brown
2100dbd8aa Fix #4167 - allow many issues for the same position 2020-09-10 17:41:45 -04:00
Andrey Savchenko
3e1758deea
Changed path output in PhpStorm report to absolute (#4159)
Needs to be absolute to be recognized and linked up by PhpStorm terminal (at least for me on Windows).

See #3271, https://youtrack.jetbrains.com/issue/IDEA-154439
2020-09-08 14:29:46 -04:00
Craig Francis
993e112236
Additional MySQL sinks, ref Issue #4155 (#4158) 2020-09-08 11:54:23 -04:00
Brown
9936419263 Fix casing 2020-09-08 09:11:47 -04:00
Brown
29efab5cc2 Fix #4154 - treat literal numeric strings as numeric 2020-09-07 23:29:46 -04:00
Brown
fe4af8ff1a Minor fixes 2020-09-07 17:22:43 -04:00
Brown
a83c0fe21a Fix signature 2020-09-07 16:44:09 -04:00
Brown
877a81f808 Always detect return type mismatches from docblock parents 2020-09-07 16:42:25 -04:00
Brown
4ffdbe0a21 Fix some signatures 2020-09-07 16:00:27 -04:00
Brown
8737abf3b8 Fix real projects bug 2020-09-07 15:14:14 -04:00
Brown
88e0811cdd Fix #4136 - allow union type properly 2020-09-07 14:08:56 -04:00
Brown
d174fc6f3f Improve fix 2020-09-07 13:19:37 -04:00
Brown
afce416bfb Fix #4136 - allow inference of callabe type param in union of callables 2020-09-07 12:56:47 -04:00
Brown
f78fbbe4c9 Fix #4146 - allow null checks on Iterator::current output 2020-09-07 11:40:36 -04:00
Brown
02a58f787b Fix #4148 - add Closure to scanned classes when arrow function is seen 2020-09-07 11:11:01 -04:00
Wouter Sioen
f3d3ef9074
Add consistent array type for predefined constants (#4151)
When running psalm through https://github.com/Roave/infection-static-analysis-plugin, you get a lot of warnings

```
Warning: array_key_exists() expects parameter 2 to be array, null given in /Users/woutersioen/Sites/madewithlove/htaccess/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Sta
tements/Expression/Fetch/ConstFetchAnalyzer.php on line 124
```

This is because the config is instantiated without calling the collectPredefinedConstants method, thus making this a null value.
By adding a default value, we make it not required to call this method before running psalm.
2020-09-07 10:54:29 -04:00
Alfred Bez
d9d8d28c2e
Document cacheDirectory behaviour (#4149) 2020-09-07 10:53:51 -04:00
orklah
8c7423505a
add native param types (#4137)
* add native param types

* redundant phpdoc

* add more param types and adds "?" to nullable types

* remove redundant phpdoc

* add more param types and remove redundant phpdoc

* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00
Matthijs Kooijman
3335b26cb4
Fixes to LSP protocol (#4143)
* Fix missing parameter in LSP textDocument.didChange

This parameter was accepted, but not documented. Since the JSON-RPC
Dispatcher looks at the comments for type information, it would fail
to find info and produce:

    PHP Notice: Undefined offset: 1 in vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php on line 141

Combined with issue #4142, this ended up violating the protocol.

* Ignore out-of-project files in textDocument.completion

Other methods, such as didOpen and didChange already checked for this,
but completion did not. This would lead to funny behaviour, where
triggering completion would cause the file to be analyzed, but only
using the on-disk state. And any changes to the file would never be
analyzed.

This ignores out-of-project files for completion, too.
2020-09-06 19:31:49 -04:00
Matthew Brown
422271b2cf Prevent variables named "haystack" from receiving literal strings
cc @staabm
2020-09-05 00:35:48 -04:00
Matthew Brown
00df5cf875 Fix unnecessary var 2020-09-04 21:57:53 -04:00
Matthew Brown
3605eeee04 Support analysing preg_match_all args in reverse to infer matches type 2020-09-04 20:33:02 -04:00
Brown
681eff6dd4 Fix type 2020-09-04 18:35:19 -04:00
Brown
2895402269 Add asterisks 2020-09-04 18:32:51 -04:00
Brown
d3d8c4ed87 Hard code possible bit-shift values 2020-09-04 18:31:50 -04:00
Brown
4d82d3ddad Fix #4128 - improve understanding of preg_match_all 2020-09-04 18:10:14 -04:00
Brown
22fe7458d8 Break up large method 2020-09-04 17:45:22 -04:00
Brown
cf3e92410c Prevent crash when suppressing UndefinedTrait
Fixes #4130
2020-09-04 16:50:10 -04:00
Brown
f4c2edf40b Fix #4132 - ignore purity of $this when checking for initialisation 2020-09-04 16:46:20 -04:00
Hans-Helge Buerger
8203150a5f
Fix link to template annotations (#4125) 2020-09-04 16:26:52 -04:00
orklah
f66d57f19d
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
the-toster
e296abbabf
Add option to show link to source in console output (#4085)
* add option to change console output for PhpStorm suitable format, so filenames become links, closes #3271

* fix code style

* rename option to php-storm-format

* replace flag with new report format

* fix code style
2020-09-04 16:24:14 -04:00
Brown
66251d8d59 Improve tests a little 2020-09-03 16:51:43 -04:00
Brown
68ebef2a2e Clean up immutable fix 2020-09-03 15:32:14 -04:00
Brown
8505ca2a23 Allow passing mutable object into immutable class to store reference 2020-09-03 15:28:09 -04:00
Brown
a4d6a845f8 Fix #4111 - ensure Closure::__invoke doesn’t break things 2020-09-03 00:13:55 -04:00
Brown
bd27e8b17b Fix #4109 - detect duplicate match condition 2020-09-02 20:08:09 -04:00
Brown
28a107e620 Fix #4112 - allow slashes in docblock tag names 2020-09-02 19:39:59 -04:00