From 1698239677b031ff30d9e6a84b80a39385e971df Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Fri, 2 Feb 2024 09:35:05 +0100 Subject: [PATCH 1/2] CallMap: Adjust return type for `inotify_add_watch()` to `int|false` See https://github.com/vimeo/psalm/issues/10636 --- dictionaries/CallMap.php | 2 +- dictionaries/CallMap_historical.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index cec0545f126..ab2c944fa0b 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -5700,7 +5700,7 @@ 'ini_restore' => ['void', 'option'=>'string'], 'ini_parse_quantity' => ['int', 'shorthand'=>'non-empty-string'], 'ini_set' => ['string|false', 'option'=>'string', 'value'=>'string|int|float|bool|null'], -'inotify_add_watch' => ['int', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], +'inotify_add_watch' => ['int|false', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], 'inotify_init' => ['resource|false'], 'inotify_queue_len' => ['int', 'inotify_instance'=>'resource'], 'inotify_read' => ['array|false', 'inotify_instance'=>'resource'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 61e3db09d55..713abcad748 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -11832,7 +11832,7 @@ 'ini_get_all' => ['array|false', 'extension='=>'?string', 'details='=>'bool'], 'ini_restore' => ['void', 'option'=>'string'], 'ini_set' => ['string|false', 'option'=>'string', 'value'=>'string'], - 'inotify_add_watch' => ['int', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], + 'inotify_add_watch' => ['int|false', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], 'inotify_init' => ['resource|false'], 'inotify_queue_len' => ['int', 'inotify_instance'=>'resource'], 'inotify_read' => ['array|false', 'inotify_instance'=>'resource'], From 9fd17cf749d148ecda5b668c76acfd307c9e1dfe Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Fri, 2 Feb 2024 10:06:03 +0100 Subject: [PATCH 2/2] CallMap: Improve returntype annotation for `inotify_read()` In case of success, it returns an array of associative arrays with defined fields: - `wd` is a watch descriptor - `mask` is a bit mask of events - `cookie` is a unique id to connect related events - `name` is the name of a file --- dictionaries/CallMap.php | 2 +- dictionaries/CallMap_historical.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index ab2c944fa0b..d1dd28456ad 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -5703,7 +5703,7 @@ 'inotify_add_watch' => ['int|false', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], 'inotify_init' => ['resource|false'], 'inotify_queue_len' => ['int', 'inotify_instance'=>'resource'], -'inotify_read' => ['array|false', 'inotify_instance'=>'resource'], +'inotify_read' => ['array{wd: int, mask: int, cookie: int, name: string}[]|false', 'inotify_instance'=>'resource'], 'inotify_rm_watch' => ['bool', 'inotify_instance'=>'resource', 'watch_descriptor'=>'int'], 'intdiv' => ['int', 'num1'=>'int', 'num2'=>'int'], 'interface_exists' => ['bool', 'interface'=>'string', 'autoload='=>'bool'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 713abcad748..d3d5f3fb110 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -11835,7 +11835,7 @@ 'inotify_add_watch' => ['int|false', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], 'inotify_init' => ['resource|false'], 'inotify_queue_len' => ['int', 'inotify_instance'=>'resource'], - 'inotify_read' => ['array|false', 'inotify_instance'=>'resource'], + 'inotify_read' => ['array{wd: int, mask: int, cookie: int, name: string}[]|false', 'inotify_instance'=>'resource'], 'inotify_rm_watch' => ['bool', 'inotify_instance'=>'resource', 'watch_descriptor'=>'int'], 'intdiv' => ['int', 'num1'=>'int', 'num2'=>'int'], 'interface_exists' => ['bool', 'interface'=>'string', 'autoload='=>'bool'],