1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Remove useless array casting as CallMap for stream_select is reset.

This commit is contained in:
Matt Brown 2022-04-27 01:40:51 -04:00
parent 890375d908
commit 043bbfbbb4
3 changed files with 17 additions and 2 deletions

View File

@ -13811,7 +13811,7 @@ return [
'stream_notification_callback' => ['callback', 'notification_code'=>'int', 'severity'=>'int', 'message'=>'string', 'message_code'=>'int', 'bytes_transferred'=>'int', 'bytes_max'=>'int'],
'stream_register_wrapper' => ['bool', 'protocol'=>'string', 'class'=>'string', 'flags='=>'int'],
'stream_resolve_include_path' => ['string|false', 'filename'=>'string'],
'stream_select' => ['int|false', '&rw_read'=>'?resource[]', '&rw_write'=>'?resource[]', '&rw_except'=>'?resource[]', 'seconds'=>'?int', 'microseconds='=>'?int'],
'stream_select' => ['int|false', '&rw_read'=>'resource[]', '&rw_write'=>'?resource[]', '&rw_except'=>'?resource[]', 'seconds'=>'?int', 'microseconds='=>'?int'],
'stream_set_blocking' => ['bool', 'stream'=>'resource', 'enable'=>'bool'],
'stream_set_chunk_size' => ['int|false', 'stream'=>'resource', 'size'=>'int'],
'stream_set_read_buffer' => ['int', 'stream'=>'resource', 'size'=>'int'],

View File

@ -367,7 +367,7 @@ class Pool
}
// For each stream that was ready, read the content.
foreach ((array)$needs_read as $file) {
foreach ($needs_read as $file) {
$buffer = fread($file, 1_024);
if ($buffer !== false) {
$content[(int)$file] .= $buffer;

View File

@ -1347,3 +1347,18 @@ function is_a($object_or_class, string $class, $allow_string = false): bool{}
* @psalm-ignore-falsable-return
*/
function mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false{}
/**
* @template TRead of null|array<array-key, resource>
* @template TWrite of null|array<array-key, resource>
* @template TExcept of null|array<array-key, resource>
* @param TRead $read
* @param TWrite $write
* @param TExcept $except
* @return false|int<0, max>
* @param-out (TRead is null ? null : array<array-key, resource>) $read
* @param-out (TWrite is null ? null : array<array-key, resource>) $write
* @param-out (TExcept is null ? null : array<array-key, resource>) $except
* @psalm-suppress ReferenceConstraintViolation
*/
function stream_select(null|array &$read, null|array &$write, null|array &$except, null|int $seconds, null|int $microseconds = null) : bool|int {}