1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00
Commit Graph

556 Commits

Author SHA1 Message Date
Corey Taylor
b053253513 Fix signatures of ldap_* functions 2022-06-23 04:21:56 -05:00
Corey Taylor
07b335d068 Update ldap parameter to ldap_unbind in callmap 2022-06-20 06:59:36 -05:00
othercorey
9ce57e6c10
Add missing ldap_unbind mapping for php 8.1 2022-06-19 07:44:53 -05:00
Benjamin Morel
d0cbf97e23 Add ReflectionClass::isEnum() 2022-06-17 16:42:21 +02:00
Alexandru Patranescu
4bafb96cee allow decimal_separator and thousands_separator parameters to be nullable in PHP 7 and 8 2022-06-15 07:43:04 +03:00
Bitwise Operators
651ad6cb50 release:fix: Change return type of createFromInterface() methods on DateTime and DateTimeImmutable to 'static' so extending classes are recognized. 2022-06-13 14:41:02 +02:00
Sam Mousa
44b2ccb4b7
fix #8099: ob_implicit_flush argument type changed to bool 2022-06-13 12:44:43 +02:00
orklah
e72e4488fc
Merge pull request #8042 from KevinVanSonsbeek/bugfix/splfileobject-fputcsv-invalidnamedargument
Bugfix/splfileobject fputcsv invalidnamedargument
2022-06-02 18:41:52 +02:00
Kevin van Sonsbeek
e402a3b822 Remove changes from delta, and retroactively fix param name in the historical callmap 2022-06-02 18:37:18 +02:00
Kevin van Sonsbeek
1042ececaf Update the CallMap to have the correct param names 2022-06-02 00:30:58 +02:00
Kevin van Sonsbeek
943131688d Updated the delta to accommodate the param name changes when going from 7.4 to 8.0 2022-06-02 00:30:33 +02:00
Vincent Langlet
087d7ce649 Update historical 2022-05-30 09:40:41 +03:00
Vincent Langlet
6352d9a855 Precise stat return type 2022-05-30 09:40:41 +03:00
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master 2022-05-28 14:49:12 -04:00
Mathieu Rochette
e2aafdeab2
Improve array_unique callmap stubs
see #7956
2022-05-23 21:19:00 +02:00
Matt Brown
fccc366c1e Merge pull request #7887 from ging-dev/lsp-fixes
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
5b91506926 cache statements even without persistent parser cache 2022-04-27 01:50:13 -04:00
Matt Brown
a9e3c1fdc1 Fix namespaced min/max int range keyword issue introduced in #7775. 2022-04-27 01:44:57 -04:00
Matt Brown
20351c6667 Avoid json_encode when serializing non-UTF8 literals
`\Psalm\Internal\Clause::$hash` basically holds a hash on
arbitrary input literals, used for later comparison. Using
`json_encode` fails when dealing with non-UTF8 literals,
which has been replaced by plain PHP `serialize`.

Resolves: #7771
2022-04-27 01:42:37 -04:00
Matt Brown
043bbfbbb4 Remove useless array casting as CallMap for stream_select is reset. 2022-04-27 01:40:51 -04:00
Matt Brown
890375d908 Cast the read streams to an array while looping over as it can be NULL. 2022-04-27 01:39:30 -04:00
Matt Brown
7360626ef4 Merge pull request #7758 from Ne-Lexa/fix-dateinterfal-false
DateInterval::createFromDateString can be false
2022-04-27 01:33:27 -04:00
Matt Brown
d58736a550 fix #7747: DateInterval::createFromDateString can be false 2022-04-27 01:32:38 -04:00
Paul Fedorow
b2d357fbb8 Fix return type of ldap_search 2022-04-23 14:55:46 +02:00
Mikko Pesari
161a8ae6c4 Fix openssl_csr_export() signature 2022-04-13 17:47:59 +03:00
hirokinoue
c6d7bc0d19 Improve Throwable::getTrace() return type 2022-04-12 23:42:37 +09:00
Daniel Kemper
2ee7ba32c7 changed return types of callmap 2022-04-12 08:49:40 +02:00
Daniel Kemper
114aad4c23 Resolve #7855 remove false from return type, in php8.0 and further versions there is a ValueError returned instead 2022-04-11 22:48:13 +02:00
Daniel Kemper
8e01a12033 Resolve #7855 remove false from return type, in php8.0 and further versions there is a ValueError returned instead 2022-04-11 22:44:36 +02:00
Matthew Rardon
9c91912281 Fix ftp_fget/_fput/_nb_fget/_nb_fput arg types 2022-03-28 11:38:18 -04:00
Ciaran McNulty
0b39384325 Add return shape for Throwable::getTrace
This is based on the documentation for debug-backtrace:
   https://php.net/debug_backtrace

Experimentation that shows the `object` field is not populated for exceptions:
   https://3v4l.org/iQoni

And validation on psalm.dev:
   https://psalm.dev/r/b35a8df2f3
2022-03-18 09:14:23 +00:00
Jack Worman
88f9e19acd #7784 PDOStatement::fetchAll() has incorrect type 2022-03-14 14:11:31 -05:00
Jack Worman
0ab947024b #7784 PDOStatement::fetchAll() has incorrect type 2022-03-14 13:33:29 -05:00
Ne-Lexa
7a43baa23c fixed return type in the historical callmap 2022-03-06 20:47:50 +03:00
Ne-Lexa
a57bb1f128 fix #7747: DateInterval::createFromDateString can be false 2022-03-05 22:37:55 +03:00
orklah
0fe6eaf5d9 Merge remote-tracking branch 'upstream/4.x' into upstream-master13 2022-02-26 21:26:59 +01:00
orklah
3a85f49268
Merge pull request #7673 from VincentLanglet/pdoException
PDOException extends RuntimeException and can use int code errors
2022-02-23 13:45:57 +01:00
Vincent Langlet
694157b2e0 PDOException extends RuntimeException and can use int code errors 2022-02-14 21:04:10 +01:00
Bruce Weirdan
edddc87002
Merge branch '4.x' into upstream-master 2022-02-13 07:14:23 +02:00
Bruce Weirdan
7f304be4fb
Merge pull request #7659 from chloekek/ErrorException-__construct-line-parameter-name 2022-02-13 05:41:51 +02:00
Sergei Morozov
946268e4fe
Update return type for mysqli::connect_error 2022-02-12 19:08:09 -08:00
Chloé Kekoa
092f729e46 Correct name of ErrorException::__construct $line param 2022-02-13 01:19:33 +01:00
Bruce Weirdan
11e60fa261
Merge branch '4.x' into upstream-master 2022-02-11 03:51:48 +02:00
Marco Pivetta
fabcda16b4 Ensure trait_exists() always returns bool
Fixes #7478

As discussed in the upstream issue, `trait_exists()` always returns `bool`: while
it can return `null` when the arguments passed to it do not match (either no arguments, or
3 or more arguments), we do not support that scenario, as that already doesn't respect the
type signature of this function.

We cut to the point: always make it `bool`, which is the scenario that works under healthy
operational conditions.

Ref: https://github.com/Roave/BetterReflection/pull/983#discussion_r790908170
Ref: https://psalm.dev/r/c41a43805d
Ref: https://github.com/vimeo/psalm/issues/7478#issuecomment-1020330351
Ref: https://github.com/vimeo/psalm/issues/7478#issuecomment-1020337712
Ref: https://3v4l.org/XpHmh
2022-02-01 16:51:09 +01:00
Bruce Weirdan
963b41d317
Merge branch '4.x' into upstream-master 2022-01-30 00:32:12 +02:00
orklah
2966f1c9d4
Merge pull request #7107 from AndrolGenhald/feature/5482-load-extensions-based-on-composer-config
Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482).
2022-01-28 18:45:52 +01:00
mal-tee
ee990ebff6 InternalTaintSinkMap: Add getimagesize as SSRF sink 2022-01-28 12:29:26 +01:00
AndrolGenhald
2fe4fc397c Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). 2022-01-27 16:30:14 -06:00
Kevin van Sonsbeek
6b59dd9c66 Made the nodeValue nullable as indicated by the docs. 2022-01-27 19:19:57 +01:00
orklah
9168cef2d4 Merge remote-tracking branch 'upstream/4.x' into upstream-master6 2022-01-26 21:06:25 +01:00
Kevin van Sonsbeek
7507274b1c Fixed return type in the historical callmap, and the old state in the CallMap_80_delta.php 2022-01-26 18:02:27 +01:00
Kevin van Sonsbeek
5a1ddf5e2d Fixed the return type in the callmap 2022-01-25 23:13:04 +01:00
Kevin van Sonsbeek
62d458bfe8 Added the change to the delta callmap for php 8.0 2022-01-25 23:12:52 +01:00
Fabien Villepinte
6bf34b5b97 Add missing parameter to Phar::getMetadata() 2022-01-25 21:35:27 +01:00
orklah
841d4f4429 improve support for enum_exists 2022-01-22 18:27:24 +01:00
orklah
af1888b631 Merge remote-tracking branch 'upstream/4.x' into upstream-master4 2022-01-22 17:48:42 +01:00
Matthias Wirtz
5b23a0c51e
in array form all attributes are nullable since PHP 7.3 2022-01-22 15:34:16 +01:00
Matthias Wirtz
bb577ec271
change nullable for array signature to be equal to param signature 2022-01-22 15:26:26 +01:00
Alberto Piai
d39ccb50bf
unify argument names in historical and current CallMap for proc_open
Since before 8.0 the named arguments were not part of the interface, we
don't care about the intermediate steps of the proc_open definition. For
consistency, this makes the definition the same across all versions.

This also fixes the type for the `options` argument already in
CallMap_historical to be nullable.

The names of the arguments are now consistent across versions, while the
delta for 7.4 reflects the change of the `command` argument from
`string` to `string|array`.
2022-01-21 09:45:28 +01:00
Alberto Piai
9b22d63c5b
fix proc_open stub for php >= 8.0
The argument names are defined here:

https://github.com/php/php-src/blob/PHP-8.0.0/ext/standard/basic_functions_arginfo.h#L1773-L1780
2022-01-20 13:57:34 +01:00
Rishi Kumar Ray
5e277d4060 Fix Incomplete return type for mb_split() function 2022-01-19 18:07:06 +05:30
5c3d9fd659
Fix kafka stubs 2022-01-19 10:14:09 +01:00
orklah
477c0113c2 Merge remote-tracking branch 'upstream/4.x' into upstream-master3 2022-01-18 18:37:04 +01:00
orklah
a0f52eae2f
Merge pull request #7407 from villfa/fix/7039
Improve signature of DOMDocument::loadXML()
2022-01-18 00:01:00 +01:00
Fabien Villepinte
c9eafa15ad Improve signature of DOMDocument::loadXML() 2022-01-17 22:52:58 +00:00
Ricardo Boss
26dd4c5b8f
Try to provide literal int types when possible (fixes #6966) (#7071)
* Fixed vimeo/psalm#6966

* Only accept >= 0 values for mode argument in round()

* Made round() only return float or literal float values and remove unneeded test

* Registered RoundReturnTypeProvider

* Updated cast analyzer to handle single string literal int values as literal ints

* Fixed psalm errors

* Fix invalid property accesses

* Addressed comments

* Added Tests

* Marked RoundReturnTypeProvider as internal

* Fixed CS
2022-01-16 21:33:04 +01:00
Fabien Villepinte
dd64326479 Update CallMap_historical too 2022-01-16 14:49:16 +01:00
Fabien Villepinte
642321ea70 Improve signature of random_bytes() 2022-01-16 14:47:42 +01:00
Bruce Weirdan
f9e6ff39fa
Merge pull request #7347 from VincentLanglet/dir 2022-01-09 00:14:28 +02:00
Vincent Langlet
c03154390a Fix dir 2022-01-08 21:49:45 +01:00
Ricardo Boss
dc0e82f6bc Updated return type of iterator_count and iterator_apply functions to 0|positive-int 2022-01-07 12:36:07 +01:00
Rudolph Gottesheim
925e5be808 Fix the return type of uniqid() in historical call map 2022-01-03 12:12:30 +01:00
Rudolph Gottesheim
ed4c22044a uniqid() returns a non-empty-string 2022-01-03 11:51:36 +01:00
orklah
926a56a97c
Merge pull request #7230 from orklah/cleanup6
code grooming
2021-12-27 22:54:39 +01:00
orklah
3e29a3d961 unnecessary qualified names 2021-12-27 20:16:34 +01:00
Matthias Wirtz
309d1a4634
add samesite option here as well 2021-12-27 09:46:58 +01:00
Matthias Wirtz
2c93b4fe0e
add missing samesite array attribute
https://www.php.net/manual/en/function.session-set-cookie-params

When using the second signature, an associative array which may have any of the keys lifetime, path, domain, secure, httponly and samesite. The values have the same meaning as described for the parameters with the same name. The value of the samesite element should be either Lax or Strict. If any of the allowed options are not given, their default values are the same as the default values of the explicit parameters. If the samesite element is omitted, no SameSite cookie attribute is set.
2021-12-25 08:12:13 +01:00
Francois Botha
014e678e97 MySqli: some parameters are nullable 2021-12-20 16:00:25 +02:00
orklah
646ba983a0
Merge pull request #7140 from yethee/soap
Fixed compatibility with SoapClient
2021-12-15 00:55:57 +01:00
orklah
2cd7b19ee3
Merge pull request #7145 from villfa/fix/ldap_set_rebind_proc
Fix ldap_set_rebind_proc signature
2021-12-15 00:49:50 +01:00
orklah
41fe5534b6
Merge pull request #7159 from AndrolGenhald/bugfix/number-format-optional-arguments
Fix optional arguments in number_format (fixes #7158).
2021-12-15 00:47:35 +01:00
orklah
5ddf5df10d
Merge pull request #7155 from rarila/partials-conversion-2
Convertion of partials to full imports
2021-12-15 00:39:20 +01:00
orklah
dcb5234b69 remove ReflectionMethod::isStatic and add ReflectionFunctionAbstract::isStatic in 8.1 2021-12-14 18:30:31 +01:00
AndrolGenhald
10b6b9aef0 Fix optional arguments in number_format (fixes #7158). 2021-12-14 09:10:05 -06:00
rarila
1c298c4605 Conversion of Psalm\Type 2021-12-14 02:31:22 +01:00
orklah
a51d16150d fix CI 2021-12-13 23:35:48 +01:00
yethee
3a574fe072
Update signatures for SoapFault 2021-12-13 22:14:09 +03:00
Fabien Villepinte
53855f19b0 Update ldap_set_rebind_proc in Callmap_historical 2021-12-13 13:02:56 +01:00
Fabien Villepinte
3bd9bbddc7 Fix ldap_set_rebind_proc signature 2021-12-13 11:06:31 +01:00
yethee
0897714964
Update signatures of methods of SoapClient 2021-12-12 19:43:06 +03:00
Kamil Tekiela
88ce10b1dc Fix count_chars stubs 2021-12-07 21:31:05 +00:00
Bruce Weirdan
142ee57836
Refine *strlen() return type to exclude negative integers
Fixes vimeo/psalm#7062
2021-12-05 03:57:36 +02:00
Kamil Tekiela
b854f436ff Improve count_chars stub 2021-12-04 20:56:17 +00:00
orklah
396ff967e0
Merge pull request #7042 from kamil-tekiela/get_class
get_class does not return false
2021-12-02 13:12:36 +01:00
orklah
90d421635d
Merge pull request #7030 from ostrolucky/rediscluster-getoption
Fix RedisCluster::getOption() and RedisCluster::setOption() argument types
2021-12-02 07:45:36 +01:00
Kamil Tekiela
19062e56a3 get_class does not return false
Technically all functions could return false or null when a wrong parameter is provided, but that was undefined behavour in PHP <8 and should not be relied upon.
2021-12-01 21:36:13 +00:00
orklah
d7d4b37ac1 year in getdate can be before 1970 for negative timestamps 2021-12-01 20:18:25 +01:00
Bruce Weirdan
28c4f86993
Merge pull request #7027 from rarila/issue-6914 2021-11-30 23:34:00 +02:00
Gabriel Ostrolucký
7b78a7e64c
Fix RedisCluster::getOption() and RedisCluster::setOption argument types
See aac42cd335/redis_cluster.stub.php (L122)

Related https://github.com/vimeo/psalm/pull/6853
2021-11-30 21:22:48 +01:00
orklah
ea03410645 refine getdate array structure 2021-11-30 21:18:10 +01:00
orklah
02b35ccada
Merge pull request #7023 from orklah/abs
refine abs return type
2021-11-29 21:20:26 +01:00
orklah
9f918a8314 refine abs return type 2021-11-29 21:16:51 +01:00
ralila
2c94ce0185 Adjust callmaps 2021-11-29 14:23:57 +01:00
Bruce Weirdan
5197a68192
Merge pull request #6987 from pilif/fix-openssl-open-callmap 2021-11-29 08:13:23 +02:00
Philip Hofstetter
323b74b8d8
fix all openssl_* signatures for PHP >= 8.0
while some signatures were already updated in the past, many others were
not.

This commits fixes all signatures to match what the PHP manual
specifies.
2021-11-29 06:21:42 +01:00
Kamil Tekiela
020c5f0d15 Fix mysqli_fetch_fields stub 2021-11-28 22:43:34 +00:00
Kamil Tekiela
84079d1833 More specific array return types 2021-11-28 22:43:34 +00:00
Kamil Tekiela
f7aa5ea4b9 Expand mysqli_fetch_array 2021-11-28 11:15:34 +00:00
Kamil Tekiela
0f22bc4c18 mysqli_fetch_* functions return mixed values 2021-11-28 10:54:07 +00:00
Bruce Weirdan
41256c74d1
Added enum-related stubs and callmaps
Fixes vimeo/psalm#6430
2021-11-28 11:41:43 +02:00
Kamil Tekiela
b44c16bc68 Fix signatures of gmstrftime and strftime 2021-11-27 22:55:34 +00:00
Kamil Tekiela
c4c97d3018 Stub fixes for mysqli extension
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-24 22:21:56 +00:00
orklah
e13c48a719
Merge pull request #6927 from veewee/soap-stub-response
Invalid SoapClient::__doRequest() response type
2021-11-22 21:23:42 +01:00
Thomas Gerbet
84d327678b usleep(0) is valid
Similar to ef9858c458.

usleep() only throws the value is < 0:
```
Uncaught ValueError: usleep(): Argument #1 ($microseconds) must be greater than or equal to 0
```
2021-11-22 11:58:39 +01:00
Benjamin Morel
ef9858c458 sleep(0) is valid 2021-11-22 09:47:34 +01:00
Ciaran McNulty
c91e245074 Update data types of file_put_contents
The main aim is to exclude boolean false, which could be coerced into '' in the following cases:

```
file_put_contents('outfile', file_get_contents('invalid_file')); // false instead of string
file_put_contents('outfile', fopen('invalid_file', 'r')); // false instead of resource
file_put_contents('outfile', file('invalid_file')); // false instead of array
```
2021-11-21 20:57:45 +00:00
MallardDuck
8292967ec4 Update crypto to use object-like array 2021-11-20 23:56:29 -05:00
MallardDuck
25cd14fe12 correct callmaps for stream_get_meta_data return 2021-11-20 12:16:22 -05:00
Kamil Tekiela
d0528a37f6 Update CallMap_80_delta.php 2021-11-16 12:02:39 +00:00
Kamil Tekiela
9f0441fcd9 Update callmap 2021-11-16 12:00:58 +00:00
Kamil Tekiela
2b05f66d36
session_set_cookie_params signature changed in 8.0 2021-11-16 11:37:19 +00:00
Toon Verwerft
df1947922f Invalid SoapClient::__doRequest() response type 2021-11-15 14:18:34 +01:00
ralila
09933db94a Adjusting delta/historical callmaps 2021-11-13 22:59:19 +01:00
ralila
8dee0476da Fix mb_convert_encoding to accept any array. 2021-11-13 20:06:49 +01:00
Toon Verwerft
b72da42dd1 Remove invalid SoapClient::__doRequest stub 2021-11-13 10:27:48 +01:00
575fd1c55a
Small fixes 2021-11-11 12:05:03 +01:00
290002c045
Small fix 2021-11-08 17:26:42 +01:00
ed6f8e0dd7
Use positive integers for various time functions 2021-11-08 17:26:39 +01:00
Bruce Weirdan
d844eabdfa
Merge pull request #6846 from jirkace/openssl_sign_callmap_php80_fix
Fixed callmap for function openssl_sign, it changed in PHP 8.0 (modif…
2021-11-08 12:53:40 +02:00
blackie
8fde59f885 fixup! fixup! Fixed callmap for function openssl_sign, it changed in PHP 8.0 (modified types for param private_key) #6842 2021-11-08 08:07:10 +01:00
Bruce Weirdan
703312278f
Merge pull request #6853 from jirkace/rediscluster_setoption_argument_types 2021-11-08 00:11:29 +02:00
blackie
e96bb7823c fixup! Fixed callmap for function openssl_sign, it changed in PHP 8.0 (modified types for param private_key) #6842 2021-11-07 20:36:26 +01:00
blackie
159a42c581 fixup! RedisCluster::setOption() argument types incorrect #4708 2021-11-07 20:18:31 +01:00
Bruce Weirdan
7fc4ae3a50
Merge pull request #6852 from jirkace/reflectionclass_newinstanceargs_docblock_fix_php80 2021-11-07 18:59:38 +02:00
blackie
a6b91384c1 RedisCluster::setOption() argument types incorrect #4708 2021-11-07 16:45:28 +01:00
blackie
cb9bf8b5af Fixed docblock for newInstanceArgs for PHP 8.0 #5136 2021-11-07 16:16:23 +01:00
blackie
bf34a3b486 DOMParentNode and DOMChildNode stubs (php 8) are missing #6771 2021-11-07 15:54:54 +01:00
blackie
d5a5db12a2 Fixed callmap for function openssl_sign, it changed in PHP 8.0 (modified types for param private_key) #6842 2021-11-07 01:44:00 +01:00
S.M. Ataur Rahman
bcc3023ac9 callmap updated as mysqli __construct()/connect() return bool in php 8.1 2021-11-03 22:02:24 +06:00
S.M. Ataur Rahman
52265d926f parameters of mysqli __construct()/connect() are nullable in php 8.0 2021-11-03 21:56:31 +06:00
S.M. Ataur Rahman
a391de6ab4 added mysqli::connect() to callmap 2021-11-03 21:41:45 +06:00
Alexey Borzov
ae4294f61d Reverted parameter names for '1 signatures, removed unneeded '1 signatures 2021-10-29 18:34:00 +03:00
Alexey Borzov
a96b93a1e3 Batch 2: checked all the signatures against PHP docs and ext/pgsql code 2021-10-29 02:22:55 +03:00
Alexey Borzov
629100aa23 Batch 1: fix 8.1 return values for query execution methods and pg_lo_open() 2021-10-28 19:44:56 +03:00
Paolo L. Scala
f445ef7dd1 Updated openssl_pkey_get_private function signature
Fixes #6469
2021-10-27 16:18:30 +02:00
Semercom
016db6869c issue-6737: fix CallMap_80 and CallMap_historical imagecropauto() arguments 2021-10-25 21:55:39 +03:00
Semercom
a9d921e9c0 issue-6737: fix CallMap imagecropauto() arguments 2021-10-25 21:29:18 +03:00
Tomas Norre Mikkelsen
b39b523fb4 Convert pgsql functions to use object instead of a resource 2021-10-14 19:30:03 +02:00
orklah
911076939c
Merge pull request #6628 from orklah/phpparser2
Php-Parser 4.13
2021-10-11 20:42:32 +02:00
Valentin Udaltsov
910258b44c Added optional offsets 3 and 4 to PDO::errorInfo and PDOStatement::errorInfo 2021-10-10 13:48:52 +03:00
orklah
870ee4ff93 ->args to ->getArgs 2021-10-09 23:37:04 +02:00
Valentin Udaltsov
e7dd53d4d1 Refined PDO::errorInfo, PDOStatement::errorInfo
See https://www.php.net/manual/ru/pdo.errorcode.php and https://www.php.net/manual/ru/pdostatement.errorinfo.php.
2021-10-09 22:09:10 +03:00
Ishan Vyas
bdb494563e
chore: remove FiberExit class from Fiber stubs
Signed-off-by: Ishan Vyas <isvyas@gmail.com>
2021-10-09 12:31:52 +05:30
Ishan Vyas
b69e670060
chore: remove FiberExit class 2021-10-09 09:34:39 +05:30
Ishan Vyas
e917546801
feat: Add Fiber stubs
Signed-off-by: Ishan Vyas <isvyas@gmail.com>
2021-10-08 23:27:48 +05:30
Manuel VACELET
d561b29e4d ReflectionClass::getReflectionConstants has a filter parameter
It was introduced in php 8.0.

Fixes #6588
2021-10-05 14:15:28 +02:00
Tomas Norre Mikkelsen
960af957db Convert PSpell resources to objects 2021-10-04 13:41:31 +02:00
Tomas Norre Mikkelsen
4b8f212ab8 Fix incorrect parameters names 2021-10-04 12:58:03 +02:00
Tomas Norre Mikkelsen
993349d64d Convert LDAP resources to objects 2021-10-04 12:57:12 +02:00
orklah
73495d73e4
Merge pull request #6567 from tomasnorre/imap-rosource-to-object
Convert imap functions to use object instead of a resource
2021-10-04 00:35:04 +02:00
orklah
246f8173e0
Merge pull request #6566 from tomasnorre/fileinfo-resource-to-object
Convert finfo functions to use object instead of a resource
2021-10-04 00:34:48 +02:00
Ishan Vyas
79270c01fd
chore: make changes in CallMap.php file
Signed-off-by: Ishan Vyas <isvyas@gmail.com>
2021-10-03 22:32:17 +05:30
Ishan Vyas
5266114222
chore: make mime field optional
Signed-off-by: Ishan Vyas <isvyas@gmail.com>
2021-10-03 22:31:06 +05:30
Ishan Vyas
75755ac4dc
Add CURLStringFile in classmap delta 2021-10-03 12:09:13 +05:30
Tomas Norre Mikkelsen
232ebb7e57 Convert imap functions to use object instead of a resource 2021-10-02 11:58:08 +02:00
Tomas Norre Mikkelsen
518e18f128 Convert finfo functions to use object instead of a resource 2021-10-02 10:16:42 +02:00
Sergei Predvoditelev
31763b3628 Fix fopen 2021-09-30 17:12:54 +03:00
Paweł Słowik
096a6dbe5c Remove undocumented / untested XlsWriter methods 2021-09-28 17:56:20 +02:00
Paweł Słowik
e1727ffe22 Update XlsWriter signatures 2021-09-28 17:56:20 +02:00
Paweł Słowik
2e51a9a8a7 Permit null user_agent to get_browser() 2021-09-17 16:46:27 +02:00
Semyon
5c375cb3c0 Revert mb_str_split return signature to list<string> 2021-09-16 15:27:34 +03:00
ssnepenthe
655c000009 Update return type for xdebug_get_profiler_filename()
Returns false when profiler is not active, string otherwise
2021-09-14 13:45:23 -07:00
Christopher Bray
847f1e41e7 Make imageavif arguments optional 2021-09-08 09:17:06 +01:00
Christopher Bray
46f7a56e13 Add imageavif to CallMap 2021-09-07 22:07:02 +01:00
Christopher Bray
1bc6a231e0 Add imagecreatefromavif to CallMap 2021-09-07 22:03:31 +01:00
Bruce Weirdan
d17f1bd7b3
Merge pull request #6447 from brayniverse/master 2021-09-07 05:26:25 +03:00
Bruce Weirdan
5535ea1ac0
$column parameter is optional 2021-09-07 03:02:25 +03:00
Christopher Bray
ba84c990dd Add mysqli_fetch_column to CallMap 2021-09-06 22:34:25 +01:00
50bhan
58e1e6b9a3 Add an optional $options argument to hash functions for PHP 8.1 2021-09-07 01:44:35 +04:30
S.M. Ataur Rahman
5ec5f7d3db introducing fsync & fdatasync functions in callmap 2021-09-07 00:24:32 +06:00
Bruce Weirdan
e3e667653a
Merge pull request #6435 from SMAtaurRahman/php8.1 2021-09-06 17:27:17 +03:00
S.M. Ataur Rahman
b6e7a77e5a introducing mysqli execute() method parameter callmap change for php 8.1 2021-09-06 19:33:58 +06:00
Nicolas Giraud
b0444f2a7d Add missing definition of callmap in the history. 2021-09-06 15:22:33 +02:00
Nicolas Giraud
9df0edbbab Force array_walk to not infer input type. 2021-09-06 15:15:25 +02:00
Bruce Weirdan
36dfeed774
Converted ftp functions to use link object instead of a resource
Fixes vimeo/psalm#6403
2021-09-04 23:44:57 +03:00
orklah
9cd8917b88 create callmap for 8.1 and introduce array_is_list 2021-09-04 13:25:23 +02:00
Bruce Weirdan
cbcc38aab8
Merge pull request #6339 from niconoe-/allow-object-on-array_walk 2021-08-31 23:45:10 +03:00
Bruce Weirdan
c4f0386aff
Merge pull request #6375 from ThomasLandauer/issue-6358 2021-08-30 04:42:37 +03:00
ThomasLandauer
fa3fd10058 Fixing null for openssl_x509_parse() in CallMap_80_delta.php too :-) 2021-08-29 12:35:28 +02:00
ThomasLandauer
630529740c Fixing null for openssl_x509_parse() 2021-08-29 12:33:19 +02:00
Bruce Weirdan
624246b996
Merge pull request #6376 from orklah/use-variable-in-backtick 2021-08-29 04:39:13 +03:00
orklah
27b6d5ad3b fix psalm errors 2021-08-29 00:39:36 +02:00
ThomasLandauer
2210003c98 Fixing openssl_x509_parse() and openssl_x509_read() Closes #6358 2021-08-29 00:04:04 +02:00
Pol Dellaiera
f0d54128b6 Update return type of getInnerIterator which is always returning an iterator. 2021-08-24 15:27:02 +02:00
Nicolas Giraud
6cff8b627f Update also historical classmap. 2021-08-19 13:03:47 +02:00
Nicolas Giraud
e254ebf5d5 Allow object type to be given to array_walk and array_walk_recursive. 2021-08-19 12:03:06 +02:00
Benjamin Morel
621c4dd8d1 Enforce class-string in is_subclass_of() 2021-08-17 23:14:11 +02:00
Vincent Langlet
4b84793b2f Add false back for mb_str_split 2021-08-17 18:45:02 +02:00
Vincent Langlet
1cdad83630 Remove false if length is positive int 2021-08-17 17:47:22 +02:00
Vincent Langlet
786d926d78 str split return non empty 2021-08-17 11:03:54 +02:00
Marc Ole Bulling
1818609f43 Fix for #6318 2021-08-16 19:23:10 +02:00
Bruce Weirdan
babfb6a637
Fix histories 2021-08-16 02:52:18 +03:00
Tyson Andre
ff72d2c92e Fix issues in php 8.0 delta
In a last minute change in php 8.0 after the feature freeze,
PhpToken::getAll was changed to tokenize

Also, https://www.php.net/manual/en/function.mb-get-info
has been around since php 4.2 - it's in psalm/dictionaries/CallMap.php
already with the same signature. Same for ReflectionNamedType::isBuiltin

Also, add signatures for getAttributes.

Also, use the same param names for fdiv that are found in reflection in
php 8.0 and 8.1 to support named arguments
2021-08-15 19:28:44 -04:00
Bruce Weirdan
cc1335022f
Fix SimpleXMLIterator historic and current signatures
Historically, `SimpleXMLIterator` had only implemented `Iterator` and
`RecursiveIterator` methods. This changed in 8.0, when iterator methods
were moved to `SimpleXMLElement`, and `SimpleXMLIterator` was made a
dummy class extending `SimpleXMLElement`.

Fixes vimeo/psalm#6305, in the sense that Psalm would no longer report
different errors depending on the runtime PHP version.
2021-08-16 00:04:59 +03:00
Valentin Udaltsov
a335535945
Added debug_backtrace return type to CallMap_historical 2021-08-13 01:45:41 +03:00
Valentin Udaltsov
8b60ebebcf Refined debug_backtrace return type 2021-08-09 10:43:33 +03:00
Maurício Meneghini Fauth
1bc71522fb
Fix wrong return type for imagejpeg GD function
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-08-08 14:57:17 -03:00
Bruce Weirdan
66056e391b
Restored some callmap types 2021-08-08 19:50:16 +03:00
Bruce Weirdan
66466cea60
Clarify delta 7.1 docblock 2021-08-08 18:55:19 +03:00
Bruce Weirdan
8c531fec4b
Tweaks
Changed the format of the historical callmap to be plain signature list,
as it isn't really a delta file and renamed the file to not be confused
with deltas.

Added a test to ensure entries in main callmap have history.
2021-08-08 18:43:42 +03:00
bjscharp
90a09a7a9a Remove outdated line about removal from delta docblocks 2021-08-08 15:42:28 +02:00
bjscharp
88f15f0526 Fix version error in delta docblocks 2021-08-08 15:40:26 +02:00
bjscharp
ada1a60a4c Corrected docblock in historic delta file 2021-08-08 11:04:15 +02:00
bjscharp
96056d329f Add simple test to verify outout of getCallMap method
Convert deltafile format to new style proposed by weirdan
Modify CallMapTest to use new format
Modify InternalCallMapHandler to use new format
Move assertions to base testcase
2021-08-08 10:39:54 +02:00
bjscharp
f39c462138 Add missing bcadd function to 8.0 delta file.
To prevent similar errors, add baseline file with signatures pre-7.1, to help verify delta files are correct.
Modify test to use this to detect missing 'old' entries
2021-08-05 23:21:41 +02:00
bjscharp
4997208ee7 Merge branch 'master' into callmap-delta-inconsistencies
# Conflicts:
#	dictionaries/CallMap_80_delta.php
2021-08-05 22:03:32 +02:00
bjscharp
ac5ea252ff Added test to detect problems and inconsistencies in CallMap files
- Fixed inconsistencies in callmap delta files (mainly 8.0)
- Added several missing changes in the bc_* functions
- Added several missing changes in the mb_* functions
- Added several missing changes in the xml_parser_* functions
- Fixed several issues with sodium_ functions
- Removed all but one of the date_* functions. All were marked as having lost the option to return false, despite this only being true for date_format
2021-08-05 19:07:31 +02:00
Mason McElvain
b2ba774cb9 Update CallMap with PHP 8 date() signature 2021-08-04 15:27:32 -07:00
Mason McElvain
81661395ce Add old date signature to CallMap_80_delta 2021-08-04 15:26:42 -07:00
Mason McElvain
4d2a5b1bfa Permit null timestamp to date() in PHP 8
PHP 8 allows the timestamp to be null, but version 7.4 doesn't.
Creates a mapping for date() to allow $timestamp to be null in PHP 8.
2021-08-04 15:07:45 -07:00
Bruce Weirdan
e34a0e39d6
s/limit/length/ 2021-08-01 16:35:09 +03:00
bjscharp
e779387b9a Added missing mb_str_split function from 7.4 2021-08-01 15:12:07 +02:00
Bruce Weirdan
f952f1b616
exec() may fail
Fixes vimeo/psalm#6195
2021-07-28 13:38:49 +03:00
Bruce Weirdan
7aa5564047
Merge pull request #6192 from orklah/array_replace_not_nullable
make array_replace and array_replace_recursive not nullable
2021-07-28 00:20:46 +03:00
orklah
d9df3211c5 make array_replace and array_replace_recursive not nullable 2021-07-27 23:02:41 +02:00
Vincent Langlet
47fa2724d7 Add false as return type of shell_exec
The doc is only talking about string|null, but
false is possible when the pipe can't be etablished
@see https://github.com/php/php-src/pull/7306#issuecomment-886489235
2021-07-26 11:08:20 +02:00
Bruce Weirdan
6eee971109
Detailed signature for fputcsv and friends
Fixes vimeo/psalm#5226
2021-07-21 00:42:36 +03:00
Bruce Weirdan
a29cbd3c95
More callmap fixes
* `writeDtdEntity()`/`xmlwriter_write_dtd_entity()` has optional params
* `xmlwriter_write_attribute_ns` has `$namespace` param as nullable, not
`$content`
* `xmlwriter_write_element()`/`xmlwriter_write_element_ns()` has
`$content` param as optional
2021-07-17 23:37:32 +03:00
Arnout Boks
08a80dd238
Fix main callmap should contain newest signatures
https://github.com/vimeo/psalm/pull/6099#discussion_r671556027
2021-07-17 22:29:56 +03:00
Arnout Boks
f90e366398
Fix incorrect signature for XMLWriter::writeAttributeNs()
https://github.com/vimeo/psalm/pull/6099#discussion_r670604872
2021-07-17 22:29:56 +03:00
Arnout Boks
f304408662
Fix incorrect signature for xmlwriter_start_dtd 2021-07-17 22:29:56 +03:00
Arnout Boks
184505733d
Correct callmap entries for XMLWriter
Checked and fixed the following, based on the current
documentation in the PHP manual:

* capitalization in method names
* parameter names
* parameter types (especially for nullable params)
* return types (especially for '|false'-types)
* differences between pre- and post-8.0.0-signatures

Fixes #6091
2021-07-17 22:29:52 +03:00
Matthew Brown
88c4e2468e
Support interface-string<Foo> as temporary alias of class-string<Foo> (#6106) 2021-07-16 18:38:39 -04:00
François Kooman
fc641de85c radius_send_request returns int|false
https://github.com/LawnGnome/php-radius/blob/master/radius.c#L533
2021-07-16 09:07:29 +02: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
Fran Moreno
decb397b8e
Add ReflectionProperty::getType() and hasType() 2021-07-10 13:05:57 +02:00
Justin
f7a2aaef6e
Update DateTime and DateTimeImmutable signatures
`DateTime::format` and `DateTimeImmutable::format` will always
return a string starting in PHP 8.0.
2021-07-03 04:29:54 -04:00
Mikko Pesari
8443cd8d24 Update mbstring signatures for PHP 8 2021-07-02 16:12:43 +03:00
61f2af88be
Make producev parameters optional 2021-06-21 11:34:41 +02:00
d4311e3086
Fix wrong rdkafka commitAsync type (#5950) 2021-06-18 08:51:39 -04:00
Christer Edvartsen
3f0de269ee
Update signatures according to the PHP manual (#5904)
* Update signatures according to the PHP manual (#5903)

* Fix return type based on php-src
2021-06-07 13:20:32 -04:00
Bruce Weirdan
689315b05f
Fix sscanf() signature (#5901)
Fixes vimeo/psalm#5870
2021-06-07 13:19:17 -04:00
Bruce Weirdan
a4871c1ef8
Provide stricter types for spl_autoload functions (#5885) 2021-06-04 15:33:12 -04:00
Fran Moreno
76225e54f6
Make toPHP second parameter optional (#5864) 2021-06-01 11:24:13 -04:00
kesselb
36d670b955
Add false as return value for mb_convert_encoding (#5862) 2021-05-31 22:24:34 -04:00
Bruce Weirdan
997ffcda4c
Add $filter parameter to ReflectionClass::getConstants() (#5847)
Fixes vimeo/psalm#5837
2021-05-28 09:48:22 -04:00
orklah
67413c88f9
fix #5797 (#5822) 2021-05-23 19:12:02 -04:00
Fran Moreno
e89f7e3960
Add mongodb Cursor and CursorInterface stubs and fix WriteConcern::__construct (#5813)
* Add mongodb Cursor and CursorInterface stubs

* Use proper variable name

* Update WriteConcern constructor

Based on https://www.php.net/manual/es/mongodb-driver-writeconcern.construct.php
2021-05-22 19:03:07 -04:00
Cyril PASCAL
c45e47d8ad Allow to use string key for preg_replace_callback callable argument 2021-04-09 15:33:16 +02:00
Sergei Morozov
b627962e63
Fix oci8 stubs for PHP 8 (#5478) 2021-03-25 00:49:53 -04:00
2edf61399a
Add detailed POSIX functions type annotations (#5469) 2021-03-24 09:52:34 -04:00
Sergei Morozov
355c4f7f09
Fix mysqli_real_connect() signature (#5464) 2021-03-24 09:51:33 -04:00
Matt Brown
a96645d2e3 Fix many uses of offsets 2021-03-23 01:30:51 -04:00
Bruce Weirdan
b4fab67f3b
Fix DateTimeZone::listIdentifiers() and timezone_identifiers_list() signature (#5443)
Including historic changes, according to php.net docs.

Fixes vimeo/psalm#5442
2021-03-20 15:43:05 -04:00
Theodore Brown
5b9efd579d
Fix type of DomElement childNodes property (#5403)
Partially addresses #5291
2021-03-16 13:42:05 -04: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
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
Sergei Morozov
594ef4fdbf
Fix mysqli_init() return type (#5306) 2021-03-01 22:50:11 -05:00
Ilija Tovilo
27e7fb554a
Fix gd CallMap for PHP 8 (#5271) 2021-03-01 11:23:45 -05:00
orklah
ae23360ed0
session_id can return false (#5272) 2021-02-23 17:26:16 -05:00
Valentin Udaltsov
7bea6f5b3c
Improved PDO::pgsqlGetNotify signature (#5169) 2021-02-06 22:07:37 -05:00
Philip Hofstetter
25659dd1a9
add missing parameter names to DateTime::createFromInterface (#5138)
this causes `Trying to access array offset on value of type int in
src/Psalm/Internal/Codebase/InternalCallMapHandler.php`
2021-02-01 10:20:12 -05:00
sji
f1123d0ccc
Fix wrong comments in CallMap_80_delta.php (#5104) 2021-01-25 11:05:13 -05:00
sji
4b9003ae9c
Bump the CURRENT PHP TARGET VERSION to 8.0 in CallMap.php (#5103) 2021-01-25 11:04:57 -05:00
sji
e61daf5c2f
Fix CallMap of PDOStatement for PHP8 (#5100)
The definitions are based on the php-src stub. 4bbb98c24f/ext/pdo/pdo_stmt.stub.php
2021-01-25 11:04:30 -05:00
Bruce Weirdan
3209ef76fe
Remove ReflectionType::getName(), move ReflectionType::isBuiltin() (#5090)
* Remove ReflectionType::getName(), move ReflectionType::isBuiltin()

* `ReflectionType::getName()` was never there: https://3v4l.org/1iZt4
* `ReflectionType::isBuiltin()` was moved to
`ReflectionNamedType::isBuiltin()` in PHP 8

Fixes vimeo/psalm#5089

* Fix test

* Mark test as php 8.0 only
2021-01-24 13:31:10 -05:00
orklah
592f6794a8
fix wrong order of types (#5058) 2021-01-20 17:41:41 -05:00
orklah
9e0525439d
add createFromInterface in PHP 8 (#5055) 2021-01-19 17:22:25 -05:00
Bruce Weirdan
fac9e46ba8
Correct gzread signature (#4960)
Fixes vimeo/psalm#4959
2021-01-08 19:50:10 -05:00
Holger Woltersdorf
30696f9089
Add missing param for constructor arguments in PDOStatement#fetchObject (#4915)
* Add missing param for constructor arguments

PDOStatement#fetchObject allows a second, optional parameter for constructor arguments, which - if given - will be passed to the given class' constructor.
See: https://www.php.net/manual/de/pdostatement.fetchobject.php

Also see the PhpStorm stubs: https://github.com/JetBrains/phpstorm-stubs/blob/master/PDO/PDO.php#L1441

* Fix wrong nullability for 2nd argument in PDOStatement#fetchObject
2020-12-31 00:59:10 +00:00
Benjamin Morel
2be2f1eb1a
GEOS stubs (#4902) 2020-12-29 11:39:46 +00:00
Benjamin Morel
3b6550f892
Return type for DateTimeZone::getTransitions() (#4879) 2020-12-26 10:34:18 +00:00
Benjamin Morel
15accfe61d
Improve DateTimeZone signatures (#4870) 2020-12-21 17:10:25 +00:00
Christer Edvartsen
2a4e5a2b1f
According to the PHP docs the session_name signature is: (#4855)
session_name ([ string|null $name = null ] ) : string|false

Resolves Possibly incorrect handling of session_name() #4854
2020-12-16 20:40:46 -05:00
Fabien Villepinte
e393a45ac7
ftp_misd may return false (#4830) 2020-12-11 14:27:32 -05:00
orklah
7c837addf5
allow passing mixed in is_a (#4780) 2020-12-06 11:28:34 -05:00
orklah
9f9b090f6a
improve pg_fetch return types (#4777) 2020-12-04 15:11:35 -05:00
Benjamin Morel
1c012caa5e
Fix ImagickPixel::getColor() (#4758) 2020-12-03 09:27:46 -05:00
Benjamin Morel
021f316ca2
Improve Imagick call map (#4757) 2020-12-02 20:42:36 -05:00
orklah
98053ead98
sync param names with php (#4745)
* sync param names with php

* fiw prefixes
2020-12-01 12:05:58 -05:00
LeSuisse
e32ed43253
Fix incorrect taint sink map for \rmdir (#4703)
Closes #4690
2020-11-25 16:45:53 -05:00
Benjamin Morel
e938933ff3
Fix PDOStatement::fetchObject() return type (#4682) 2020-11-23 15:52:14 -05:00
Matt Brown
ea9cb72143 First creation_function param isnÆt really a sink 2020-11-20 09:56:53 -05:00
Markus Staab
acb4bb42e1
documented type in InternalTaintSinkMap (#4627) 2020-11-19 19:27:40 -05:00
Lukas Reschke
78f4a0691c
Add dedicated types for 'file', 'header' and 'cookie' (#4630)
* [WIP] Add dedicated sinks for 'file', 'header' and 'cookie'

* Add documentation

* Add mapping for taint flows

* Add tests

* Fix test
2020-11-19 17:47:29 -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
Lukas Reschke
5ba4681c17
Add SSRF sinks (#4592) 2020-11-18 00:52:48 -05:00
Matt Brown
43af3b1a57 Break out TaintedInput issues into a lot of separate ones 2020-11-17 12:44:31 -05:00
Benjamin Morel
08716233e6
DateTimeInterface::getTimeZone() can return false (#4579)
Fixes #4515
2020-11-16 21:48:34 -05:00
Benjamin Morel
d313f57061
mysqli::$insert_id can be a string (#4577) 2020-11-16 21:48:04 -05:00
Tyson Andre
d71ed7b9e9
Fix curl_multi_getcontent signature (#4580) 2020-11-16 21:47:33 -05:00
Lukas Reschke
09abcfb650
Add sinks for popen and proc_open (#4572)
User input in those two functions could lead to a RCE.

popen: https://www.php.net/manual/en/function.popen.php
proc_open: https://www.php.net/manual/en/function.proc-open.php
2020-11-16 15:04:22 -05:00
orklah
317986c7a3
Add undocumented properties in SoapFault (#4510) 2020-11-08 13:15:49 -05:00
Matt Brown
b5a3f45d52 Remove use of PHP 7.2 function 2020-11-04 11:02:34 -05:00
Philip Hofstetter
5abde20fd0
improve mb_strtolower return type (#4469)
this fixes #4455
2020-11-02 08:18:42 -05:00
Matt Brown
dab1aac9d4 Protect more calls 2020-10-28 13:48:13 -04:00
Matt Brown
4aef96bbac Use lists everywhere for args 2020-10-28 12:45:26 -04:00
Matt Brown
f72e2d7de5 Fix #4374 - prevent paradox and allow Psalm to understand more assignments in conditionals 2020-10-20 14:43:05 -04:00
Matt Brown
b904b1d173 getShortName does not return a class-string 2020-10-19 22:35:09 -04:00