Skip to content

Commit

Permalink
Include setrawcookie as an impure function
Browse files Browse the repository at this point in the history
  • Loading branch information
edsrzf committed Feb 21, 2023
1 parent 471a8c6 commit a03299f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Codebase/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public function isCallMapFunctionPure(
'call_user_func', 'call_user_func_array', 'define', 'create_function',

// http
'header', 'header_remove', 'http_response_code', 'setcookie',
'header', 'header_remove', 'http_response_code', 'setcookie', 'setrawcookie',

// output buffer
'ob_start', 'ob_end_clean', 'ob_get_clean', 'readfile', 'printf', 'var_dump', 'phpinfo',
Expand Down
7 changes: 7 additions & 0 deletions tests/UnusedCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,13 @@ function makesACounter(int $i) : Counter {
return $c;
}',
],
'setRawCookieImpure' => [
'code' => '<?php
setrawcookie(
"name",
"value",
);',
],
'usedUsort' => [
'code' => '<?php
/** @param string[] $arr */
Expand Down

0 comments on commit a03299f

Please sign in to comment.