1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #7828 from mstilkerich/impure_readline

Psalm considers most readline functions as pure, but they have side effects
This commit is contained in:
orklah 2022-04-01 16:26:21 +02:00 committed by GitHub
commit c209c66263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,7 +404,7 @@ class Functions
'opendir', 'readdir', 'closedir', 'rewinddir', 'scandir',
'fopen', 'fread', 'fwrite', 'fclose', 'touch', 'fpassthru', 'fputs', 'fscanf', 'fseek', 'flock',
'ftruncate', 'fprintf', 'symlink', 'mkdir', 'unlink', 'rename', 'rmdir', 'popen', 'pclose',
'fgetcsv', 'fputcsv', 'umask', 'finfo_open', 'finfo_close', 'finfo_file', 'readline_add_history',
'fgetcsv', 'fputcsv', 'umask', 'finfo_open', 'finfo_close', 'finfo_file',
'stream_set_timeout', 'fgets', 'fflush', 'move_uploaded_file', 'file_exists', 'realpath', 'glob',
'is_readable', 'is_dir', 'is_file',
@ -515,6 +515,10 @@ class Functions
return false;
}
if (strpos($function_id, 'readline') === 0) {
return false;
}
if (($function_id === 'var_export' || $function_id === 'print_r') && !isset($args[1])) {
return false;
}