• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sirbrillig / phpcs-variable-analysis / 15118106362

19 May 2025 04:19PM UTC coverage: 93.79%. Remained the same
15118106362

Pull #353

github

jrfnl
Ruleset: update schema URL

PHPCS now offers permalinks for the schema.

Refs:
* PHPCSStandards/PHP_CodeSniffer 1094
* https://github.com/PHPCSStandards/schema.phpcodesniffer.com
Pull Request #353: Ruleset: update schema URL

1903 of 2029 relevant lines covered (93.79%)

138.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/VariableAnalysis/Lib/Constants.php
1
<?php
2

3
namespace VariableAnalysis\Lib;
4

5
class Constants
6
{
7
        /**
8
         *  Array of known pass-by-reference functions and the argument(s) which are passed
9
         *  by reference, the arguments are numbered starting from 1 and an elipsis '...'
10
         *  means all argument numbers after the previous should be considered pass-by-reference.
11
         *
12
         *  This does not need to cover all pass-by-reference arguments, only the
13
         *  ones which can be passed an undefined variable (eg: `$matches` in
14
         *  `preg_match`) and will define that variable.
15
         *
16
         *  @return array<string, array<int|string>>
17
         */
18
        public static function getPassByReferenceFunctions()
162✔
19
        {
20
                return [
81✔
21
                        '__soapCall' => [5],
162✔
22
                        'addFunction' => [3],
162✔
23
                        'addTask' => [3],
162✔
24
                        'addTaskBackground' => [3],
162✔
25
                        'addTaskHigh' => [3],
162✔
26
                        'addTaskHighBackground' => [3],
162✔
27
                        'addTaskLow' => [3],
162✔
28
                        'addTaskLowBackground' => [3],
162✔
29
                        'addTaskStatus' => [2],
162✔
30
                        'apc_dec' => [3],
162✔
31
                        'apc_fetch' => [2],
162✔
32
                        'apc_inc' => [3],
162✔
33
                        'apcu_dec' => [3],
162✔
34
                        'apcu_fetch' => [2],
162✔
35
                        'apcu_inc' => [3],
162✔
36
                        'areConfusable' => [3],
162✔
37
                        'arsort' => [1],
162✔
38
                        'asort' => [1],
162✔
39
                        'bindColumn' => [2],
162✔
40
                        'bindParam' => [2],
162✔
41
                        'bind_param' => [2, 3, '...'],
162✔
42
                        'bind_result' => [1, 2, '...'],
162✔
43
                        'call_user_method' => [2],
162✔
44
                        'call_user_method_array' => [2],
162✔
45
                        'curl_multi_exec' => [2],
162✔
46
                        'curl_multi_info_read' => [2],
162✔
47
                        'current' => [1],
162✔
48
                        'dbplus_curr' => [2],
162✔
49
                        'dbplus_first' => [2],
162✔
50
                        'dbplus_info' => [3],
162✔
51
                        'dbplus_last' => [2],
162✔
52
                        'dbplus_next' => [2],
162✔
53
                        'dbplus_prev' => [2],
162✔
54
                        'dbplus_tremove' => [3],
162✔
55
                        'dns_get_record' => [3, 4],
162✔
56
                        'domxml_open_file' => [3],
162✔
57
                        'domxml_open_mem' => [3],
162✔
58
                        'each' => [1],
162✔
59
                        'enchant_dict_quick_check' => [3],
162✔
60
                        'end' => [1],
162✔
61
                        'ereg' => [3],
162✔
62
                        'eregi' => [3],
162✔
63
                        'exec' => [2, 3],
162✔
64
                        'exif_thumbnail' => [1, 2, 3],
162✔
65
                        'expect_expectl' => [3],
162✔
66
                        'extract' => [1],
162✔
67
                        'filter' => [3],
162✔
68
                        'flock' => [2,3],
162✔
69
                        'fscanf' => [2, 3, '...'],
162✔
70
                        'fsockopen' => [3, 4],
162✔
71
                        'ftp_alloc' => [3],
162✔
72
                        'get' => [2, 3],
162✔
73
                        'getByKey' => [4],
162✔
74
                        'getMulti' => [2],
162✔
75
                        'getMultiByKey' => [3],
162✔
76
                        'getimagesize' => [2],
162✔
77
                        'getmxrr' => [2, 3],
162✔
78
                        'gnupg_decryptverify' => [3],
162✔
79
                        'gnupg_verify' => [4],
162✔
80
                        'grapheme_extract' => [5],
162✔
81
                        'headers_sent' => [1, 2],
162✔
82
                        'http_build_url' => [4],
162✔
83
                        'http_get' => [3],
162✔
84
                        'http_head' => [3],
162✔
85
                        'http_negotiate_charset' => [2],
162✔
86
                        'http_negotiate_content_type' => [2],
162✔
87
                        'http_negotiate_language' => [2],
162✔
88
                        'http_post_data' => [4],
162✔
89
                        'http_post_fields' => [5],
162✔
90
                        'http_put_data' => [4],
162✔
91
                        'http_put_file' => [4],
162✔
92
                        'http_put_stream' => [4],
162✔
93
                        'http_request' => [5],
162✔
94
                        'isSuspicious' => [2],
162✔
95
                        'is_callable' => [3],
162✔
96
                        'key' => [1],
162✔
97
                        'krsort' => [1],
162✔
98
                        'ksort' => [1],
162✔
99
                        'ldap_get_option' => [3],
162✔
100
                        'ldap_parse_reference' => [3],
162✔
101
                        'ldap_parse_result' => [3, 4, 5, 6],
162✔
102
                        'localtime' => [2],
162✔
103
                        'm_completeauthorizations' => [2],
162✔
104
                        'maxdb_stmt_bind_param' => [3, 4, '...'],
162✔
105
                        'maxdb_stmt_bind_result' => [2, 3, '...'],
162✔
106
                        'mb_convert_variables' => [3, 4, '...'],
162✔
107
                        'mb_parse_str' => [2],
162✔
108
                        'mqseries_back' => [2, 3],
162✔
109
                        'mqseries_begin' => [3, 4],
162✔
110
                        'mqseries_close' => [4, 5],
162✔
111
                        'mqseries_cmit' => [2, 3],
162✔
112
                        'mqseries_conn' => [2, 3, 4],
162✔
113
                        'mqseries_connx' => [2, 3, 4, 5],
162✔
114
                        'mqseries_disc' => [2, 3],
162✔
115
                        'mqseries_get' => [3, 4, 5, 6, 7, 8, 9],
162✔
116
                        'mqseries_inq' => [6, 8, 9, 10],
162✔
117
                        'mqseries_open' => [2, 4, 5, 6],
162✔
118
                        'mqseries_put' => [3, 4, 6, 7],
162✔
119
                        'mqseries_put1' => [2, 3, 4, 6, 7],
162✔
120
                        'mqseries_set' => [9, 10],
162✔
121
                        'msg_receive' => [3, 5, 8],
162✔
122
                        'msg_send' => [6],
162✔
123
                        'mssql_bind' => [3],
162✔
124
                        'natcasesort' => [1],
162✔
125
                        'natsort' => [1],
162✔
126
                        'ncurses_color_content' => [2, 3, 4],
162✔
127
                        'ncurses_getmaxyx' => [2, 3],
162✔
128
                        'ncurses_getmouse' => [1],
162✔
129
                        'ncurses_getyx' => [2, 3],
162✔
130
                        'ncurses_instr' => [1],
162✔
131
                        'ncurses_mouse_trafo' => [1, 2],
162✔
132
                        'ncurses_mousemask' => [2],
162✔
133
                        'ncurses_pair_content' => [2, 3],
162✔
134
                        'ncurses_wmouse_trafo' => [2, 3],
162✔
135
                        'newt_button_bar' => [1],
162✔
136
                        'newt_form_run' => [2],
162✔
137
                        'newt_get_screen_size' => [1, 2],
162✔
138
                        'newt_grid_get_size' => [2, 3],
162✔
139
                        'newt_reflow_text' => [5, 6],
162✔
140
                        'newt_win_entries' => [7],
162✔
141
                        'newt_win_menu' => [8],
162✔
142
                        'next' => [1],
162✔
143
                        'oci_bind_array_by_name' => [3],
162✔
144
                        'oci_bind_by_name' => [3],
162✔
145
                        'oci_define_by_name' => [3],
162✔
146
                        'oci_fetch_all' => [2],
162✔
147
                        'ocifetchinto' => [2],
162✔
148
                        'odbc_fetch_into' => [2],
162✔
149
                        'openssl_csr_export' => [2],
162✔
150
                        'openssl_csr_new' => [2],
162✔
151
                        'openssl_open' => [2],
162✔
152
                        'openssl_pkcs12_export' => [2],
162✔
153
                        'openssl_pkcs12_read' => [2],
162✔
154
                        'openssl_pkey_export' => [2],
162✔
155
                        'openssl_private_decrypt' => [2],
162✔
156
                        'openssl_private_encrypt' => [2],
162✔
157
                        'openssl_public_decrypt' => [2],
162✔
158
                        'openssl_public_encrypt' => [2],
162✔
159
                        'openssl_random_pseudo_bytes' => [2],
162✔
160
                        'openssl_seal' => [2, 3],
162✔
161
                        'openssl_sign' => [2],
162✔
162
                        'openssl_x509_export' => [2],
162✔
163
                        'ovrimos_fetch_into' => [2],
162✔
164
                        'parse' => [2,3],
162✔
165
                        'parseCurrency' => [2, 3],
162✔
166
                        'parse_str' => [2],
162✔
167
                        'parsekit_compile_file' => [2],
162✔
168
                        'parsekit_compile_string' => [2],
162✔
169
                        'passthru' => [2],
162✔
170
                        'pcntl_sigprocmask' => [3],
162✔
171
                        'pcntl_sigtimedwait' => [2],
162✔
172
                        'pcntl_sigwaitinfo' => [2],
162✔
173
                        'pcntl_wait' => [1],
162✔
174
                        'pcntl_waitpid' => [2],
162✔
175
                        'pfsockopen' => [3, 4],
162✔
176
                        'php_check_syntax' => [2],
162✔
177
                        'poll' => [1, 2, 3],
162✔
178
                        'preg_filter' => [5],
162✔
179
                        'preg_match' => [3],
162✔
180
                        'preg_match_all' => [3],
162✔
181
                        'preg_replace' => [5],
162✔
182
                        'preg_replace_callback' => [5],
162✔
183
                        'prev' => [1],
162✔
184
                        'proc_open' => [3],
162✔
185
                        'query' => [3],
162✔
186
                        'queryExec' => [2],
162✔
187
                        'reset' => [1],
162✔
188
                        'rsort' => [1],
162✔
189
                        'settype' => [1],
162✔
190
                        'shuffle' => [1],
162✔
191
                        'similar_text' => [3],
162✔
192
                        'socket_create_pair' => [4],
162✔
193
                        'socket_getpeername' => [2, 3],
162✔
194
                        'socket_getsockname' => [2, 3],
162✔
195
                        'socket_recv' => [2],
162✔
196
                        'socket_recvfrom' => [2, 5, 6],
162✔
197
                        'socket_select' => [1, 2, 3],
162✔
198
                        'sort' => [1],
162✔
199
                        'sortWithSortKeys' => [1],
162✔
200
                        'sqlite_exec' => [3],
162✔
201
                        'sqlite_factory' => [3],
162✔
202
                        'sqlite_open' => [3],
162✔
203
                        'sqlite_popen' => [3],
162✔
204
                        'sqlite_query' => [4],
162✔
205
                        'sqlite_unbuffered_query' => [4],
162✔
206
                        'sscanf' => [3, '...'],
162✔
207
                        'str_ireplace' => [4],
162✔
208
                        'str_replace' => [4],
162✔
209
                        'stream_open' => [4],
162✔
210
                        'stream_select' => [1, 2, 3],
162✔
211
                        'stream_socket_accept' => [3],
162✔
212
                        'stream_socket_client' => [2, 3],
162✔
213
                        'stream_socket_recvfrom' => [4],
162✔
214
                        'stream_socket_server' => [2, 3],
162✔
215
                        'system' => [2],
162✔
216
                        'uasort' => [1],
162✔
217
                        'uksort' => [1],
162✔
218
                        'unbufferedQuery' => [3],
162✔
219
                        'usort' => [1],
162✔
220
                        'wincache_ucache_dec' => [3],
162✔
221
                        'wincache_ucache_get' => [2],
162✔
222
                        'wincache_ucache_inc' => [3],
162✔
223
                        'xdiff_string_merge3' => [4],
162✔
224
                        'xdiff_string_patch' => [4],
162✔
225
                        'xml_parse_into_struct' => [3, 4],
162✔
226
                        'xml_set_object' => [2],
162✔
227
                        'xmlrpc_decode_request' => [2],
162✔
228
                        'xmlrpc_set_type' => [1],
162✔
229
                        'xslt_set_object' => [2],
162✔
230
                        'yaml_parse' => [3],
162✔
231
                        'yaml_parse_file' => [3],
162✔
232
                        'yaml_parse_url' => [3],
162✔
233
                        'yaz_ccl_parse' => [3],
162✔
234
                        'yaz_hits' => [2],
162✔
235
                        'yaz_scan_result' => [2],
162✔
236
                        'yaz_wait' => [1],
162✔
237
                ];
162✔
238
        }
239

240
        /**
241
         * @return array<string, array<int>>
242
         */
243
        public static function getWordPressPassByReferenceFunctions()
4✔
244
        {
245
                return [
2✔
246
                        'wp_parse_str' => [2],
4✔
247
                        'wp_cache_get' => [4],
4✔
248
                ];
4✔
249
        }
250

251
        /**
252
         * A regexp for matching variable names in double-quoted strings.
253
         *
254
         * @return string
255
         */
256
        public static function getDoubleQuotedVarRegexp()
168✔
257
        {
258
                return '|(?<!\\\\)(?:\\\\{2})*\${?([a-zA-Z0-9_]+)}?|';
168✔
259
        }
260
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc