1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
Commit Graph

146 Commits

Author SHA1 Message Date
Markus Staab
e037c4496a
Utilize non-falsy-string 2021-07-15 20:40:18 +02:00
Markus Staab
2671ea78da
Detailed return type for strtoupper 2021-07-15 20:15:08 +02:00
Bruce Weirdan
a5a2377dcf
Detailed return types for str_pad() and str_repeat()
Fixes vimeo/psalm#6049
2021-07-15 01:54:03 +03:00
Bruce Weirdan
f93d925bdc
Updated join signature to match implode
Fixes vimeo/psalm#6080
2021-07-12 23:59:34 +03:00
Bruce Weirdan
83bf9b8ed9
Merge pull request #5608 from paxal/patch/preg_replace_callback
Allow to use string key for preg_replace_callback callable argument
2021-07-11 04:55:03 +03:00
elnoro
ec7aaa4a47
Update stubs/CoreGenericFunctions.phpstub
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-07-09 23:25:12 +05:00
Ruslan Karimov
b373c0c7f9 added str_word_count to the stub file (fix #6016) 2021-07-09 21:45:18 +05:00
Matt Brown
6d4d1668f6 Allow more types for back-compat 2021-06-21 20:11:00 -04:00
Matt Brown
d8f4eb2d6d Restrict type of implode to prevent Array-to-string conversion; 2021-06-21 19:55:27 -04:00
Matt Brown
9dde8eed9d Add support for literal-int annotations as well 2021-06-14 23:24:09 -04:00
Matt Brown
3140654a44 Experiment with implode literal tracking 2021-06-14 16:03:37 -04:00
Matt Brown
47bf5ed567 Fix #5918 - add new issue to detect unquoted strings 2021-06-10 17:43:04 -04:00
Bruce Weirdan
689315b05f
Fix sscanf() signature (#5901)
Fixes vimeo/psalm#5870
2021-06-07 13:19:17 -04:00
Oliver Hader
4898cd262e
[TASK] Enrich taint details for outputting core stubs (#5827)
Affects `printf`, `print_r`, `var_dump`, `var_export`
2021-05-24 16:42:18 -04:00
orklah
67413c88f9
fix #5797 (#5822) 2021-05-23 19:12:02 -04:00
still-dreaming-1
ecb4ca8730
strlen can return positive-int (#5793) 2021-05-19 15:20:56 -04:00
still-dreaming-1
a62ee22adb
htmlspecialchars can return non-empty-string (#5785) 2021-05-17 19:43:08 -04:00
Robert Chettleburgh
fe190c2eb7
unpack() can return false on error (#5726)
* Unpack() can return false on error

* unpack only returns false rarely

supporess with @psalm-ignore-falsable-return

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

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-05-06 14:32:17 -04:00
AndrolGenhald
518d0af895
Strict int/float comparison for conditional types, improve range return type (#5601) 2021-04-09 11:28:48 -04:00
Cyril PASCAL
c45e47d8ad Allow to use string key for preg_replace_callback callable argument 2021-04-09 15:33:16 +02:00
orklah
09ee4c1d79
json_encode does not return false if JSON_THROW_ON_ERROR is in flags (#5417) 2021-03-18 09:41:44 -04:00
orklah
1149050817
adapt bcdiv for PHP8 in stubs (#5401) 2021-03-16 13:45:54 -04:00
orklah
1a3ff5676a
fix stub for array_combine + remove false in PHP8 + improve tests (#5395) 2021-03-16 13:43:49 -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
e60c333f2d Fix completion of Foo:: before an if statement 2021-02-15 11:12:04 -05:00
orklah
1d9987e0ed
fix phpdoc (#4905) 2020-12-29 11:42:41 +00:00
Matthew Brown
3390097b35 Fix #4874 - remove strok stub 2020-12-21 17:14:25 +00:00
Alies Lapatsin
c07cba8da4
#4772 Mark 3rd argument of get_headers nullable and optional (#4774)
There is no documentation that $context is nullable but it’s better to mark is nullable and use default value so psalm will not ask to use all 3 parameters.
2020-12-03 23:14:43 -05:00
Matt Brown
0ea4a702ed Fix range return type to always non-empty lists 2020-11-27 20:09:53 -05:00
Matthew Brown
1320081d27
Fix core return types 2020-11-25 11:49:51 -05:00
orklah
45c6189190
restore str_split as a list (#4694) 2020-11-24 15:01:46 -05:00
Matt Brown
27b7de285e Fix some stubs 2020-11-24 10:44:33 -05:00
Lukas Reschke
7ac42551de
Add some more flows (#4659)
* Add some more flows

- Adds all relevant JSON flows https://www.php.net/manual/en/ref.json.php
- Adds all relevant misc flows https://www.php.net/manual/en/ref.misc.php
- Adds a small subset of URL flows https://www.php.net/manual/en/ref.url.php

* Update CoreGenericFunctions.phpstub
2020-11-22 12:09:55 -05:00
Lukas Reschke
3943b55f8a
Add psalm-flow for string functions from sscanf to wordwrap (#4591)
* Add string functions from sscanf to wordwrap

This should conclude all string functions from https://www.php.net/manual/en/book.strings.php

Continuation of https://github.com/vimeo/psalm/pull/4576

Ref https://github.com/vimeo/psalm/issues/3636

* Add StrTrReturnTypeProvider

* Fix psalm error

* phpcs

* Line length

* Ignore false return on vsprintf

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-21 17:35:07 -05:00
Lukas Reschke
ddbfbb28e6
Split LDAP into custom category (#4604)
- Adds ldap_escape as sanitizer
- Defines the right parameters to ldap_search as sink
- Wrote documentation
- Added tests
2020-11-18 11:39:36 -05:00
Michael Stilkerich
fec51eac8d
Stub for preg_filter (#4587) 2020-11-17 15:15:29 -05:00
Matt Brown
42802e11d1 Allow PHP major version to determine substr return type 2020-11-16 16:31:33 -05:00
Lukas Reschke
6780b01453
Add more Psalm flows for string functions (#4576)
This adds string functions from
https://www.php.net/manual/en/ref.strings.php

This commit adds the flows for functions from "addcslashes" to "sprintf".
More are to follow in later commits.

Ref #3636
2020-11-16 15:50:07 -05:00
Matt Brown
4ea87b9054 Add support for int-mask<...> and int-mask-of<...> 2020-10-30 13:28:45 -04:00
Simon Podlipsky
6bbf06f7cc
Fix preg_match_all param name (#4416) 2020-10-26 11:53:03 -04:00
Matt Brown
5cda754a9c Remove stubs with variadic middle params
Fixees #4377
2020-10-25 21:07:13 -04:00
Marcus Bointon
e172e88274
Fix preg_match_all stub (#4325)
* preg_match_all can return false

* Test for preg_match_all returning false

* Fix test

* Add @psalm-ignore-falsable-return
2020-10-14 19:59:07 -04:00
Matt Brown
bb7d7132f7 Do arithmetic for preg_split arguments 2020-10-12 20:26:02 -04:00
Matt Brown
2ac2da6079 Improve preg_split return more 2020-10-12 19:16:48 -04:00
Matt Brown
f83b50460a Add better return type for preg_split 2020-10-12 13:04:28 -04:00
Matt Brown
f3b05f5ab5 Move static code out of src 2020-10-12 00:59:19 -04:00