Skip to content

Commit c8a7996

Browse files
authored
Update functionMap
1 parent e031e6f commit c8a7996

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

resources/functionMap.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@
15431543
'date_default_timezone_set' => ['bool', 'timezone_identifier'=>'string'],
15441544
'date_diff' => ['DateInterval', 'obj1'=>'DateTimeInterface', 'obj2'=>'DateTimeInterface', 'absolute='=>'bool'],
15451545
'date_format' => ['string', 'obj'=>'DateTimeInterface', 'format'=>'string'],
1546-
'date_get_last_errors' => ['array{warning_count: int, warnings: array<int, string>, error_count: int, errors: array<int, string>}|false'],
1546+
'date_get_last_errors' => ['array{warning_count: 0|positive-int, warnings: list<string>, error_count: 0|positive-int, errors: list<string>}|false'],
15471547
'date_interval_create_from_date_string' => ['DateInterval|false', 'time'=>'string'],
15481548
'date_interval_format' => ['string', 'object'=>'DateInterval', 'format'=>'string'],
15491549
'date_isodate_set' => ['DateTime|false', 'object'=>'DateTime', 'year'=>'int', 'week'=>'int', 'day='=>'int|mixed'],
@@ -1601,7 +1601,7 @@
16011601
'DateTime::createFromImmutable' => ['static', 'object'=>'DateTimeImmutable'],
16021602
'DateTime::diff' => ['DateInterval', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'],
16031603
'DateTime::format' => ['string', 'format'=>'string'],
1604-
'DateTime::getLastErrors' => ['array{warning_count: int, warnings: array<int, string>, error_count: int, errors: array<int, string>}|false'],
1604+
'DateTime::getLastErrors' => ['array{warning_count: 0|positive-int, warnings: list<string>, error_count: 0|positive-int, errors: list<string>}|false'],
16051605
'DateTime::getOffset' => ['int'],
16061606
'DateTime::getTimestamp' => ['int'],
16071607
'DateTime::getTimezone' => ['DateTimeZone'],
@@ -1620,7 +1620,7 @@
16201620
'DateTimeImmutable::createFromMutable' => ['static', 'datetime'=>'DateTime'],
16211621
'DateTimeImmutable::diff' => ['DateInterval', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'],
16221622
'DateTimeImmutable::format' => ['string', 'format'=>'string'],
1623-
'DateTimeImmutable::getLastErrors' => ['array{warning_count: int, warnings: array<int, string>, error_count: int, errors: array<int, string>}|false'],
1623+
'DateTimeImmutable::getLastErrors' => ['array{warning_count: 0|positive-int, warnings: list<string>, error_count: 0|positive-int, errors: list<string>}|false'],
16241624
'DateTimeImmutable::getOffset' => ['int'],
16251625
'DateTimeImmutable::getTimestamp' => ['int'],
16261626
'DateTimeImmutable::getTimezone' => ['DateTimeZone'],
@@ -2639,7 +2639,7 @@
26392639
'explode' => ['list<string>|false', 'separator'=>'string', 'str'=>'string', 'limit='=>'int'],
26402640
'expm1' => ['float', 'number'=>'float'],
26412641
'extension_loaded' => ['bool', 'extension_name'=>'string'],
2642-
'extract' => ['int', '&rw_var_array'=>'array', 'extract_type='=>'int', 'prefix='=>'string|null'],
2642+
'extract' => ['0|positive-int', '&rw_var_array'=>'array', 'extract_type='=>'int', 'prefix='=>'string|null'],
26432643
'ezmlm_hash' => ['int', 'addr'=>'string'],
26442644
'fam_cancel_monitor' => ['bool', 'fam'=>'resource', 'fam_monitor'=>'resource'],
26452645
'fam_close' => ['void', 'fam'=>'resource'],
@@ -2968,7 +2968,7 @@
29682968
'filter_id' => ['int|false', 'filtername'=>'string'],
29692969
'filter_input' => ['mixed', 'type'=>'int', 'variable_name'=>'string', 'filter='=>'int', 'options='=>'array|int'],
29702970
'filter_input_array' => ['array|false|null', 'type'=>'int', 'definition='=>'int|array', 'add_empty='=>'bool'],
2971-
'filter_list' => ['array'],
2971+
'filter_list' => ['non-empty-list<non-falsy-string>'],
29722972
'filter_var' => ['mixed', 'variable'=>'mixed', 'filter='=>'int', 'options='=>'mixed'],
29732973
'filter_var_array' => ['array|false|null', 'data'=>'array', 'definition='=>'mixed', 'add_empty='=>'bool'],
29742974
'FilterIterator::__construct' => ['void', 'iterator'=>'Iterator'],
@@ -5700,7 +5700,7 @@
57005700
'jpeg2wbmp' => ['bool', 'jpegname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'],
57015701
'json_decode' => ['mixed', 'json'=>'string', 'assoc='=>'bool|null', 'depth='=>'positive-int', 'options='=>'int'],
57025702
'json_encode' => ['non-empty-string|false', 'data'=>'mixed', 'options='=>'int', 'depth='=>'positive-int'],
5703-
'json_last_error' => ['int'],
5703+
'json_last_error' => ['JSON_ERROR_NONE|JSON_ERROR_DEPTH|JSON_ERROR_STATE_MISMATCH|JSON_ERROR_CTRL_CHAR|JSON_ERROR_SYNTAX|JSON_ERROR_UTF8|JSON_ERROR_RECURSION|JSON_ERROR_INF_OR_NAN|JSON_ERROR_UNSUPPORTED_TYPE|JSON_ERROR_INVALID_PROPERTY_NAME|JSON_ERROR_UTF16'],
57045704
'json_last_error_msg' => ['string'],
57055705
'JsonIncrementalParser::__construct' => ['void', 'depth'=>'', 'options'=>''],
57065706
'JsonIncrementalParser::get' => ['', 'options'=>''],
@@ -8318,10 +8318,10 @@
83188318
'openssl_encrypt' => ['string|false', 'data'=>'string', 'method'=>'string', 'key'=>'string', 'options='=>'int', 'iv='=>'string', '&w_tag='=>'string', 'aad='=>'string', 'tag_length='=>'int'],
83198319
'openssl_error_string' => ['string|false'],
83208320
'openssl_free_key' => ['void', 'key_identifier'=>'resource'],
8321-
'openssl_get_cert_locations' => ['array'],
8322-
'openssl_get_cipher_methods' => ['array', 'aliases='=>'bool'],
8321+
'openssl_get_cert_locations' => ['array<non-falsy-string, string>'],
8322+
'openssl_get_cipher_methods' => ['list<string>', 'aliases='=>'bool'],
83238323
'openssl_get_curve_names' => ['list<string>|false'],
8324-
'openssl_get_md_methods' => ['array', 'aliases='=>'bool'],
8324+
'openssl_get_md_methods' => ['list<string>', 'aliases='=>'bool'],
83258325
'openssl_get_privatekey' => ['resource|false', 'key'=>'string', 'passphrase='=>'string'],
83268326
'openssl_get_publickey' => ['resource|false', 'cert'=>'resource|string'],
83278327
'openssl_open' => ['bool', 'sealed_data'=>'string', '&w_open_data'=>'string', 'env_key'=>'string', 'priv_key_id'=>'string|array|resource', 'method='=>'string', 'iv='=>'string'],
@@ -12017,7 +12017,7 @@
1201712017
'stream_set_write_buffer' => ['int', 'fp'=>'resource', 'buffer'=>'int'],
1201812018
'stream_socket_accept' => ['resource|false', 'serverstream'=>'resource', 'timeout='=>'float', '&w_peername='=>'string'],
1201912019
'stream_socket_client' => ['resource|false', 'remoteaddress'=>'string', '&w_errcode='=>'int', '&w_errstring='=>'string', 'timeout='=>'float', 'flags='=>'int', 'context='=>'resource'],
12020-
'stream_socket_enable_crypto' => ['int|bool', 'stream'=>'resource', 'enable'=>'bool', 'cryptokind='=>'int', 'sessionstream='=>'resource'],
12020+
'stream_socket_enable_crypto' => ['0|bool', 'stream'=>'resource', 'enable'=>'bool', 'cryptokind='=>'int', 'sessionstream='=>'resource'],
1202112021
'stream_socket_get_name' => ['string|false', 'stream'=>'resource', 'want_peer'=>'bool'],
1202212022
'stream_socket_pair' => ['resource[]|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'],
1202312023
'stream_socket_recvfrom' => ['string|false', 'stream'=>'resource', 'amount'=>'int', 'flags='=>'int', '&w_remote_addr='=>'string'],

resources/functionMap_bleedingEdge.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@
122122
'ftp_put' => ['bool', 'stream'=>'resource', 'remote_file'=>'string', 'local_file'=>'string', 'mode='=>'FTP_ASCII|FTP_BINARY', 'startpos='=>'int'],
123123
'scandir' => ['list<string>|false', 'dir'=>'string', 'sorting_order='=>'SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING| SCANDIR_SORT_NONE', 'context='=>'resource'],
124124
'stream_socket_client' => ['resource|false', 'remoteaddress'=>'string', '&w_errcode='=>'int', '&w_errstring='=>'string', 'timeout='=>'float', 'flags='=>'int-mask<STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_PERSISTENT>', 'context='=>'resource'],
125-
'extract' => ['int', '&rw_var_array'=>'array', 'extract_type='=>'EXTR_OVERWRITE|EXTR_SKIP|EXTR_PREFIX_SAME|EXTR_PREFIX_ALL|EXTR_PREFIX_INVALID|EXTR_IF_EXISTS|EXTR_PREFIX_IF_EXISTS|EXTR_REFS', 'prefix='=>'string|null'],
125+
'stream_socket_enable_crypto' => ['0|bool', 'stream'=>'resource', 'enable'=>'bool', 'crypto_method='=>'STREAM_CRYPTO_METHOD_SSLv2_CLIENT|STREAM_CRYPTO_METHOD_SSLv3_CLIENT|STREAM_CRYPTO_METHOD_SSLv23_CLIENT|STREAM_CRYPTO_METHOD_ANY_CLIENT|STREAM_CRYPTO_METHOD_TLS_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT|STREAM_CRYPTO_METHOD_SSLv2_SERVER|STREAM_CRYPTO_METHOD_SSLv3_SERVER|STREAM_CRYPTO_METHOD_SSLv23_SERVER|STREAM_CRYPTO_METHOD_ANY_SERVER|STREAM_CRYPTO_METHOD_TLS_SERVER|STREAM_CRYPTO_METHOD_TLSv1_0_SERVER|STREAM_CRYPTO_METHOD_TLSv1_1_SERVER|STREAM_CRYPTO_METHOD_TLSv1_2_SERVER|STREAM_CRYPTO_METHOD_TLSv1_3_SERVER', 'session_stream='=>'resource'],
126+
'extract' => ['0|positive-int', '&rw_var_array'=>'array', 'extract_type='=>'EXTR_OVERWRITE|EXTR_SKIP|EXTR_PREFIX_SAME|EXTR_PREFIX_ALL|EXTR_PREFIX_INVALID|EXTR_IF_EXISTS|EXTR_PREFIX_IF_EXISTS|EXTR_REFS', 'prefix='=>'string|null'],
126127
],
127128
'old' => [
128129

tests/PHPStan/Analyser/data/bug-2863.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use function PHPStan\Testing\assertType;
66

77
$result = json_decode('{"a":5}');
8-
assertType('int', json_last_error());
8+
assertType('0|1|2|3|4|5|6|7|8|9|10', json_last_error());
99
assertType('string', json_last_error_msg());
1010

1111
if (json_last_error() !== JSON_ERROR_NONE || json_last_error_msg() !== 'No error') {
@@ -17,7 +17,7 @@
1717

1818
//
1919
$result2 = json_decode('');
20-
assertType('int', json_last_error());
20+
assertType('0|1|2|3|4|5|6|7|8|9|10', json_last_error());
2121
assertType('string', json_last_error_msg());
2222

2323
if (json_last_error() !== JSON_ERROR_NONE || json_last_error_msg() !== 'No error') {
@@ -29,7 +29,7 @@
2929

3030
//
3131
$result3 = json_encode([]);
32-
assertType('int', json_last_error());
32+
assertType('0|1|2|3|4|5|6|7|8|9|10', json_last_error());
3333
assertType('string', json_last_error_msg());
3434

3535
if (json_last_error() !== JSON_ERROR_NONE || json_last_error_msg() !== 'No error') {

tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PHPStan\Type\Constant\ConstantStringType;
2020
use PHPStan\Type\FileTypeMapper;
2121
use PHPStan\Type\IntegerType;
22+
use PHPStan\Type\IntegerRangeType;
2223
use PHPStan\Type\MixedType;
2324
use PHPStan\Type\NullType;
2425
use PHPStan\Type\ObjectType;
@@ -94,9 +95,9 @@ public function dataFunctions(): array
9495
new ConstantStringType('error_count'),
9596
new ConstantStringType('errors'),
9697
], [
97-
new IntegerType(),
98+
IntegerRangeType::fromInterval(0, null),
9899
new ArrayType(new IntegerType(), new StringType()),
99-
new IntegerType(),
100+
IntegerRangeType::fromInterval(0, null),
100101
new ArrayType(new IntegerType(), new StringType()),
101102
]),
102103
]),

0 commit comments

Comments
 (0)