1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-05 21:19:03 +01:00
Commit Graph

430 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Benjamin Morel
e938933ff3
Fix PDOStatement::fetchObject() return type (#4682) 2020-11-23 15:52:14 -05:00
Benjamin Morel
08716233e6
DateTimeInterface::getTimeZone() can return false (#4579)
Fixes #4515
2020-11-16 21:48:34 -05:00
Tyson Andre
d71ed7b9e9
Fix curl_multi_getcontent signature (#4580) 2020-11-16 21:47:33 -05:00
Philip Hofstetter
5abde20fd0
improve mb_strtolower return type (#4469)
this fixes #4455
2020-11-02 08:18:42 -05: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
Matt Brown
eeacec315a 4.x - fix callmap regressions 2020-10-12 10:08:15 -04:00
Matt Brown
b85cbd01a7 4.x - add support for PHP 8 callmap 2020-10-12 09:41:25 -04:00
Matt Brown
903d7f3601 Add more fixes 2020-10-12 08:26:17 -04:00
Matt Brown
321b81e1f0 Fix order 2020-10-12 02:00:03 -04:00
Matt Brown
c9954b34f6 Add changes from PHPStan‘s functionmap 2020-10-12 01:56:04 -04:00
Matt Brown
f3b05f5ab5 Move static code out of src 2020-10-12 00:59:19 -04:00