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

347 Commits

Author SHA1 Message Date
Benjamin Morel
ee7fc0fad8 Fix XMLReader::expand() nullable parameter $baseNode 2022-11-01 13:26:41 +01:00
Alies Lapatsin
9516baced6 Update str_split signature to reflect PHP 8.2 changes 2022-10-31 21:27:46 +03:00
Alies Lapatsin
b450eac812 Add PHP 8.2 functions to the main delta 2022-10-31 13:00:11 +03:00
Alies Lapatsin
ceb50e5cd5
Merge branch '4.x' into php82 2022-10-31 13:00:29 +04:00
Alies Lapatsin
61e95f948d Add removed section 2022-10-31 01:42:05 +03:00
Alies Lapatsin
6cf0657c6a Add dictionary delta for PHP 8.2 2022-10-31 00:43:40 +03:00
Alies Lapatsin
ea5f4cb569 Add PHP 8.0 delta for hash_hkdf() 2022-10-09 17:40:52 +03:00
Alies Lapatsin
198a4ba9b0 Return non-empty-string by hash functions 2022-10-09 17:31:14 +03:00
Alies Lapatsin
ee86d6360c
Remove extra changes 2022-10-09 18:05:35 +04:00
Alies Lapatsin
3c3839b5cb
Update hash(), hash_file() and hash_init() types
see https://github.com/php/php-src/blob/php-8.1.5/ext/hash/hash.stub.php
2022-10-09 18:01:27 +04:00
Alies Lapatsin
dec8d0edc2
Mark hash functions as non-false
See https://github.com/php/php-src/issues/7759 and PR https://github.com/phpstan/phpstan-src/pull/822/files#
2022-10-09 17:49:17 +04:00
Peter de Blieck
ea5c2a1302 Changed signature of imap_undelete in 8.1 delta 2022-10-06 08:52:36 +02:00
Peter de Blieck
f1d1721fa7 Fixed function signatures of imap_delete and imap_undelete 2022-10-05 14:36:33 +02:00
kkmuffme
ce76158085 fix crash in <PHP8 with ResourceBundle
partially reverts https://github.com/vimeo/psalm/pull/8217
2022-09-22 01:01:08 +02:00
Ricardo Boss
bf1c0320fd Cherry-pick: 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-09-19 21:54:16 +02:00
orklah
8185260126
Merge pull request #8490 from tvdijen/setAttributeNS
Add null-type to several DOM-functions
2022-09-18 13:55:41 +02:00
Tim van Dijen
2a315bef45 Fix some more 2022-09-18 11:53:09 +02:00
Tim van Dijen
3b737480bd Fix CallMap_historical 2022-09-18 11:51:39 +02:00
Tim van Dijen
eb93f69251 Add null-type to several DOM-functions 2022-09-18 11:51:36 +02:00
George Steel
17ca8ef014
date_get_last_errors(), DateTime::getLastErrors() may return false
Up to PHP 8.2, these functions return false if no previous date operations have been performed. In PHP 8.2, false is returned after a date operation that yields neither warnings nor errors:

https://3v4l.org/HBq0q
https://3v4l.org/3QsKY
Signed-off-by: George Steel <george@net-glue.co.uk>
2022-09-13 23:51:32 +01:00
orklah
eba63a3821
Merge pull request #8367 from kkmuffme/revert-nullable-curl_multi_getcontent
partial revert nullable type for curl_multi_getcontent
2022-09-08 22:58:29 +02:00
kkmuffme
6e4c1823d6 partial revert nullable type for curl_multi_getcontent
Fix https://github.com/vimeo/psalm/issues/8351

Partially reverts f28ac73777
2022-09-08 21:46:15 +02:00
Andreas Braun
48bf5496d8
Add missing parameter type for Serializable::unserialize 2022-08-26 10:03:08 +02:00
Andreas Braun
5b8f611e73
Handle tentative return types for interfaces correctly 2022-08-25 15:27:04 +02:00
Andreas Braun
6a6922d29e
Update call maps for MongoDB extension 2022-08-25 14:35:54 +02:00
orklah
0d0a049eb2
Merge pull request #8405 from vjik/get-modifiers-name
Clarification of `Reflection::getModifierNames()` result type
2022-08-12 18:53:47 +02:00
Sergei Predvoditelev
4498a523b9
fix 2022-08-12 16:12:36 +03:00
Sergei Predvoditelev
ffe4375a60
Clarification of Reflection::getModifierNames() result type 2022-08-12 16:03:56 +03:00
Paul Fedorow
8908638219 Fix imageinterlace function signature 2022-08-12 11:22:45 +02:00
Marco Pivetta
a1ed84f1ed Removed DateTimeImmutable::createFromMutable() from the CallMap: fully covered by stub 2022-08-05 12:52:32 +02:00
Marco Pivetta
aaac9ccb90 Removed DateTimeImmutable::setTimestamp() from the CallMap: fully covered by stub
Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.1.x): 32d55f7422/ext/date/php_date.c (L3353-L3369)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3596-L3612)
2022-08-05 12:50:51 +02:00
Marco Pivetta
964f64a500 Removed DateTimeImmutable::setISODate() from the CallMap: fully covered by stub
Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.1.x): 32d55f7422/ext/date/php_date.c (L3308-L3324)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3549-L3565)
2022-08-05 12:49:45 +02:00
Marco Pivetta
0a6c9d0177 Removed DateTimeImmutable::setDate() from the CallMap: fully covered by stub
Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.1.x): 32d55f7422/ext/date/php_date.c (L3258-L3274)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3496-L3512)
2022-08-05 12:48:29 +02:00
Marco Pivetta
e61c593a2c Removed DateTimeImmutable::setTime() from the CallMap: fully covered by stub
Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.1.x): 32d55f7422/ext/date/php_date.c (L3212-L3228)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3447-L3463)
2022-08-05 12:47:04 +02:00
Marco Pivetta
4fe554d6d2 Removed DateTimeImmutable::setTimezone() from the CallMap: fully covered by stub
Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.2.x): 534127d3b2/ext/date/php_date.c (L3291-L3307)
Ref (PHP 8.2.x): 534127d3b2/ext/date/php_date.stub.php (L517-L518)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3363-L3379)
2022-08-05 12:42:45 +02:00
Marco Pivetta
cb9939cbd3 Removed DateTimeImmutable::add() from the CallMap: fully covered by stub
Ref: 534127d3b2/ext/date/php_date.stub.php (L511-L512)
Ref: 534127d3b2/ext/date/php_date.c (L3129-L3144)
2022-08-05 12:39:16 +02:00
Marco Pivetta
7cd3d49dc4 Removed DateTimeImmutable::modify() from the CallMap: fully covered by stub
Also expanded the return type from `static` to `static|false`, since the
operation can fail (with a warning too), such as in following example:

https://3v4l.org/Xrjlc

```php
<?php

var_dump(
    (new DateTimeImmutable())
        ->modify('potato')
);
```

Produces

```
Warning: DateTimeImmutable::modify(): Failed to parse time string (potato) at position 0 (p): The timezone could not be found in the database in /in/Xrjlc on line 6
bool(false)
```

Ref: 534127d3b2/ext/date/php_date.stub.php (L508-L509)
2022-08-05 12:37:24 +02:00
Marco Pivetta
18557b8c70 Removed DateTimeImmutable::diff() from the CallMap: fully covered by stub 2022-08-05 12:34:31 +02:00
Marco Pivetta
002585b57e Removed DateTimeImmutable::getTimestamp() from the CallMap: fully covered by stub
This also simplifies the return type from `int|false` to always `int`,
since a timestamp can always be produced.

Ref: eff9aed159/ext/date/php_date.stub.php (L496-L500)
2022-08-05 12:32:26 +02:00
Marco Pivetta
1be04e0988 Removed DateTimeImmutable::getOffset() from the CallMap: fully covered by stub 2022-08-05 12:27:29 +02:00
Marco Pivetta
2b6fddf88d Removed DateTimeImmutable::getTimezone() from the CallMap: fully covered by stub
Note: also verified that a `DateTimeImmutable#getTimezone()` always returns
a default timezone (initialized internally), and therefore restricted the
type a bit.
2022-08-05 12:26:59 +02:00
Marco Pivetta
7ee12c7493 Removed DateTimeImmutable::format() from the CallMap: fully covered by stub
Note: some conditional return type magic was required here.

See: https://github.com/vimeo/psalm/pull/8350#discussion_r937089212
2022-08-05 12:24:35 +02:00
Marco Pivetta
58ca4e0b73 Removed DateTimeImmutable::createFromFormat() from the CallMap: fully covered by stub 2022-08-05 12:23:43 +02:00
Marco Pivetta
267d76088d Removed DateTimeImmutable::sub() from the CallMap: fully covered by stub 2022-08-05 12:23:00 +02:00
Marco Pivetta
dc7d26abb1 Removed DateTimeImmutable::__construct from the CallMap: fully covered by stub 2022-08-05 12:22:27 +02:00
Vincent Langlet
90ac39d89f Fix formatCurrency return type 2022-07-30 23:31:21 +02:00
Mathieu Rochette
14241d74b3
ReflectionProperty::getValue $object is nullable since php 8.0
https://www.php.net/manual/en/reflectionproperty.getvalue.php
2022-07-29 22:14:12 +02:00
Honca
8b5999470a Fixed ini_set types for arg value 2022-07-22 11:09:03 +02:00
orklah
4fbbf820d8
Merge pull request #8228 from othercorey/callmap-nullable
Fix nullable return types for CallMap functions
2022-07-14 09:03:35 +02:00
Corey Taylor
f28ac73777 Fix nullable return types for CallMap functions 2022-07-13 22:44:38 -05:00