Skip to content

Commit

Permalink
mark readline* function having side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab committed Apr 1, 2022
1 parent 120bc98 commit c0849a1
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bin/functionMetadata_original.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@
'pclose' => ['hasSideEffects' => true],
'popen' => ['hasSideEffects' => true],
'readfile' => ['hasSideEffects' => true],
'readline' => ['hasSideEffects' => true],
'readline_add_history' => ['hasSideEffects' => true],
'readline_callback_handler_install' => ['hasSideEffects' => true],
'readline_callback_handler_remove' => ['hasSideEffects' => true],
'readline_callback_read_char' => ['hasSideEffects' => true],
'readline_clear_history' => ['hasSideEffects' => true],
'readline_completion_function' => ['hasSideEffects' => true],
'readline_info' => ['hasSideEffects' => true],
'readline_list_history' => ['hasSideEffects' => true],
'readline_on_new_line' => ['hasSideEffects' => true],
'readline_read_history' => ['hasSideEffects' => true],
'readline_redisplay' => ['hasSideEffects' => true],
'readline_write_history' => ['hasSideEffects' => true],
'rename' => ['hasSideEffects' => true],
'rewind' => ['hasSideEffects' => true],
'rmdir' => ['hasSideEffects' => true],
Expand Down
13 changes: 13 additions & 0 deletions bin/generate-function-metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ public function enterNode(Node $node)
$template = <<<'php'
<?php declare(strict_types = 1);
/**
* GENERATED FILE - DO NOT EDIT!
*
* This file is generated automatically when running bin/generate-function-metadata.php
* and the result is merged from bin/functionMetadata_original.php and by looking at jetbrains/phpstorm-stubs methods
* and functions with the #[Pure] attribute.
*
* If you want to add new entries here follow these steps:
* 1) Contribute the functions that have 'hasSideEffects' => true as a modification to bin/functionMetadata_original.php.
* 2) Contribute the #[Pure] functions without side effects to https://github.com/JetBrains/phpstorm-stubs
* 3) Once the PR from 2) is merged, please update the package here and run ./bin/generate-function-metadata.php.
*/

return [
%s
];
Expand Down
67 changes: 67 additions & 0 deletions bug-6265.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php declare(strict_types = 1);

namespace Bug1157;

class swThreads
{
public function sort_comments_in_thread_array($comment, $thread_parentid = 0)
{
if ($thread_parentid)
{
if (isset($this->comments['#' . $comment['thread_parentid']]))
{
if (in_array('#' . $comment['parentid'], $lv1_keys))
{
if (!$match)
{
for ($ii = 0;$ii < count($lv2_keys);$ii++)
{
if (!$match3)
{
for ($iii = 0;$iii < count($lv3_keys_all);$iii++)
{
if (!$match4)
{
for ($iiii = 0;$iiii < count($lv4_keys_all);$iiii++)
{
if (!$match5)
{
for ($i6 = 0;$i6 < count($lv5_keys_all);$i6++)
{
if (!$match6)
{
for ($i7 = 0;$i7 < count($lv6_keys_all);$i7++)
{
if (!$match7)
{
for ($i8 = 0;$i8 < count($lv7_keys_all);$i8++)
{
if (!$match8)
{
for ($i9 = 0;$i9 < count($lv8_keys_all);$i9++)
{
if (!$match9)
{

}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return true;
}
}
}

}
26 changes: 26 additions & 0 deletions resources/functionMetadata.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?php declare(strict_types = 1);

/**
* GENERATED FILE - DO NOT EDIT!
*
* This file is generated automatically when running bin/generate-function-metadata.php
* and the result is merged from bin/functionMetadata_original.php and by looking at jetbrains/phpstorm-stubs methods
* and functions with the #[Pure] attribute.
*
* If you want to add new entries here follow these steps:
* - Contribute the functions that have 'hasSideEffects' => true as a modification to bin/functionMetadata_original.php.
* - Contribute the #[Pure] functions without side effects to https://github.com/JetBrains/phpstorm-stubs
* - Once the PR from 2) is merged, please update the package here and run ./bin/generate-function-metadata.php.
*/

return [
'CURLFile::getFilename' => ['hasSideEffects' => false],
'CURLFile::getMimeType' => ['hasSideEffects' => false],
Expand Down Expand Up @@ -1404,6 +1417,19 @@
'rawurldecode' => ['hasSideEffects' => false],
'rawurlencode' => ['hasSideEffects' => false],
'readfile' => ['hasSideEffects' => true],
'readline' => ['hasSideEffects' => true],
'readline_add_history' => ['hasSideEffects' => true],
'readline_callback_handler_install' => ['hasSideEffects' => true],
'readline_callback_handler_remove' => ['hasSideEffects' => true],
'readline_callback_read_char' => ['hasSideEffects' => true],
'readline_clear_history' => ['hasSideEffects' => true],
'readline_completion_function' => ['hasSideEffects' => true],
'readline_info' => ['hasSideEffects' => true],
'readline_list_history' => ['hasSideEffects' => true],
'readline_on_new_line' => ['hasSideEffects' => true],
'readline_read_history' => ['hasSideEffects' => true],
'readline_redisplay' => ['hasSideEffects' => true],
'readline_write_history' => ['hasSideEffects' => true],
'readlink' => ['hasSideEffects' => false],
'realpath' => ['hasSideEffects' => false],
'realpath_cache_get' => ['hasSideEffects' => false],
Expand Down

0 comments on commit c0849a1

Please sign in to comment.