Skip to content
Permalink
Browse files

Add better handling of print_r

  • Loading branch information...
muglug committed Sep 7, 2019
1 parent ae2c671 commit 8be43398f040fab9ab2f9f67be3b45e611b300b5
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/Psalm/Internal/Codebase/Functions.php
@@ -284,7 +284,7 @@ public function isCallMapFunctionPure(Codebase $codebase, string $function_id, a
'header', 'header_remove', 'http_response_code', 'setcookie',
// output buffer
'ob_start', 'ob_end_clean', 'readfile', 'var_dump', 'printf', 'print_r', 'phpinfo',
'ob_start', 'ob_end_clean', 'readfile', 'printf', 'var_dump', 'phpinfo',
// internal optimisation
'opcache_compile_file', 'clearstatcache',
@@ -319,6 +319,7 @@ public function isCallMapFunctionPure(Codebase $codebase, string $function_id, a
'set_error_handler', 'user_error', 'trigger_error', 'restore_error_handler',
'date_default_timezone_set', 'assert', 'assert_options', 'setlocale',
'set_exception_handler', 'set_time_limit', 'putenv', 'spl_autoload_register',
'microtime', 'array_rand',
// logging
'openlog', 'syslog', 'error_log', 'define_syslog_variables',
@@ -341,7 +342,7 @@ public function isCallMapFunctionPure(Codebase $codebase, string $function_id, a
return false;
}
if ($function_id === 'var_export' && !isset($args[1])) {
if (($function_id === 'var_export' || $function_id === 'print_r') && !isset($args[1])) {
return false;
}

0 comments on commit 8be4339

Please sign in to comment.
You can’t perform that action at this time.