Skip to content

Commit 580dbf3

Browse files
authored
Merge pull request #27 from moufmouf/default_by_ref
Undeclared "by reference" arguments are ignored
2 parents 315cdf7 + 03998c2 commit 580dbf3

File tree

15 files changed

+40
-147
lines changed

15 files changed

+40
-147
lines changed

generated/apc.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ function apc_compile_file(string $filename, bool $atomic = true)
6161
function apc_dec(string $key, int $step = 1, bool &$success = null): int
6262
{
6363
error_clear_last();
64-
if ($success !== null) {
65-
$result = \apc_dec($key, $step, $success);
66-
} else {
67-
$result = \apc_dec($key, $step);
68-
}
64+
$result = \apc_dec($key, $step, $success);
6965
if ($result === false) {
7066
throw ApcException::createFromPhpError();
7167
}
@@ -164,11 +160,7 @@ function apc_delete(string $key)
164160
function apc_inc(string $key, int $step = 1, bool &$success = null): int
165161
{
166162
error_clear_last();
167-
if ($success !== null) {
168-
$result = \apc_inc($key, $step, $success);
169-
} else {
170-
$result = \apc_inc($key, $step);
171-
}
163+
$result = \apc_inc($key, $step, $success);
172164
if ($result === false) {
173165
throw ApcException::createFromPhpError();
174166
}

generated/apcu.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ function apcu_cas(string $key, int $old, int $new): void
4040
function apcu_dec(string $key, int $step = 1, bool &$success = null): int
4141
{
4242
error_clear_last();
43-
if ($success !== null) {
44-
$result = \apcu_dec($key, $step, $success);
45-
} else {
46-
$result = \apcu_dec($key, $step);
47-
}
43+
$result = \apcu_dec($key, $step, $success);
4844
if ($result === false) {
4945
throw ApcuException::createFromPhpError();
5046
}
@@ -88,11 +84,7 @@ function apcu_delete($key): void
8884
function apcu_inc(string $key, int $step = 1, bool &$success = null): int
8985
{
9086
error_clear_last();
91-
if ($success !== null) {
92-
$result = \apcu_inc($key, $step, $success);
93-
} else {
94-
$result = \apcu_inc($key, $step);
95-
}
87+
$result = \apcu_inc($key, $step, $success);
9688
if ($result === false) {
9789
throw ApcuException::createFromPhpError();
9890
}

generated/ftp.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void
1919
{
2020
error_clear_last();
21-
if ($result !== null) {
22-
$result = \ftp_alloc($ftp_stream, $filesize, $result);
23-
} else {
24-
$result = \ftp_alloc($ftp_stream, $filesize);
25-
}
21+
$result = \ftp_alloc($ftp_stream, $filesize, $result);
2622
if ($result === false) {
2723
throw FtpException::createFromPhpError();
2824
}

generated/ldap.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ function ldap_bind($link_identifier, string $bind_rdn = null, string $bind_passw
6969
function ldap_control_paged_result_response($link, $result, string &$cookie = null, int &$estimated = null): void
7070
{
7171
error_clear_last();
72-
if ($estimated !== null) {
73-
$result = \ldap_control_paged_result_response($link, $result, $cookie, $estimated);
74-
} elseif ($cookie !== null) {
75-
$result = \ldap_control_paged_result_response($link, $result, $cookie);
76-
} else {
77-
$result = \ldap_control_paged_result_response($link, $result);
78-
}
72+
$result = \ldap_control_paged_result_response($link, $result, $cookie, $estimated);
7973
if ($result === false) {
8074
throw LdapException::createFromPhpError();
8175
}
@@ -968,13 +962,7 @@ function ldap_next_attribute($link_identifier, $result_entry_identifier): string
968962
function ldap_parse_exop($link, $result, string &$retdata = null, string &$retoid = null): void
969963
{
970964
error_clear_last();
971-
if ($retoid !== null) {
972-
$result = \ldap_parse_exop($link, $result, $retdata, $retoid);
973-
} elseif ($retdata !== null) {
974-
$result = \ldap_parse_exop($link, $result, $retdata);
975-
} else {
976-
$result = \ldap_parse_exop($link, $result);
977-
}
965+
$result = \ldap_parse_exop($link, $result, $retdata, $retoid);
978966
if ($result === false) {
979967
throw LdapException::createFromPhpError();
980968
}
@@ -1003,17 +991,7 @@ function ldap_parse_exop($link, $result, string &$retdata = null, string &$retoi
1003991
function ldap_parse_result($link, $result, int &$errcode, string &$matcheddn = null, string &$errmsg = null, array &$referrals = null, array &$serverctrls = null): void
1004992
{
1005993
error_clear_last();
1006-
if ($serverctrls !== null) {
1007-
$result = \ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls);
1008-
} elseif ($referrals !== null) {
1009-
$result = \ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals);
1010-
} elseif ($errmsg !== null) {
1011-
$result = \ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg);
1012-
} elseif ($matcheddn !== null) {
1013-
$result = \ldap_parse_result($link, $result, $errcode, $matcheddn);
1014-
} else {
1015-
$result = \ldap_parse_result($link, $result, $errcode);
1016-
}
994+
$result = \ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls);
1017995
if ($result === false) {
1018996
throw LdapException::createFromPhpError();
1019997
}

generated/mbstring.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,7 @@ function mb_ord(string $str, string $encoding = null): int
344344
function mb_parse_str(string $encoded_string, array &$result = null): void
345345
{
346346
error_clear_last();
347-
if ($result !== null) {
348-
$result = \mb_parse_str($encoded_string, $result);
349-
} else {
350-
$result = \mb_parse_str($encoded_string);
351-
}
347+
$result = \mb_parse_str($encoded_string, $result);
352348
if ($result === false) {
353349
throw MbstringException::createFromPhpError();
354350
}

generated/network.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,7 @@ function closelog(): void
245245
function dns_get_record(string $hostname, int $type = DNS_ANY, array &$authns = null, array &$addtl = null, bool $raw = false): array
246246
{
247247
error_clear_last();
248-
if ($raw !== false) {
249-
$result = \dns_get_record($hostname, $type, $authns, $addtl, $raw);
250-
} elseif ($addtl !== null) {
251-
$result = \dns_get_record($hostname, $type, $authns, $addtl);
252-
} elseif ($authns !== null) {
253-
$result = \dns_get_record($hostname, $type, $authns);
254-
} else {
255-
$result = \dns_get_record($hostname, $type);
256-
}
248+
$result = \dns_get_record($hostname, $type, $authns, $addtl, $raw);
257249
if ($result === false) {
258250
throw NetworkException::createFromPhpError();
259251
}

generated/openssl.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,7 @@ function openssl_public_encrypt(string $data, string &$crypted, $key, int $paddi
890890
function openssl_random_pseudo_bytes(int $length, bool &$crypto_strong = null): string
891891
{
892892
error_clear_last();
893-
if ($crypto_strong !== null) {
894-
$result = \openssl_random_pseudo_bytes($length, $crypto_strong);
895-
} else {
896-
$result = \openssl_random_pseudo_bytes($length);
897-
}
893+
$result = \openssl_random_pseudo_bytes($length, $crypto_strong);
898894
if ($result === false) {
899895
throw OpensslException::createFromPhpError();
900896
}
@@ -929,11 +925,7 @@ function openssl_random_pseudo_bytes(int $length, bool &$crypto_strong = null):
929925
function openssl_seal(string $data, string &$sealed_data, array &$env_keys, array $pub_key_ids, string $method = "RC4", string &$iv = null): int
930926
{
931927
error_clear_last();
932-
if ($iv !== null) {
933-
$result = \openssl_seal($data, $sealed_data, $env_keys, $pub_key_ids, $method, $iv);
934-
} else {
935-
$result = \openssl_seal($data, $sealed_data, $env_keys, $pub_key_ids, $method);
936-
}
928+
$result = \openssl_seal($data, $sealed_data, $env_keys, $pub_key_ids, $method, $iv);
937929
if ($result === false) {
938930
throw OpensslException::createFromPhpError();
939931
}

generated/pcntl.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ function pcntl_signal_dispatch(): void
129129
function pcntl_sigprocmask(int $how, array $set, array &$oldset = null): void
130130
{
131131
error_clear_last();
132-
if ($oldset !== null) {
133-
$result = \pcntl_sigprocmask($how, $set, $oldset);
134-
} else {
135-
$result = \pcntl_sigprocmask($how, $set);
136-
}
132+
$result = \pcntl_sigprocmask($how, $set, $oldset);
137133
if ($result === false) {
138134
throw PcntlException::createFromPhpError();
139135
}

generated/pcre.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,7 @@
351351
function preg_match_all(string $pattern, string $subject, array &$matches = null, int $flags = PREG_PATTERN_ORDER, int $offset = 0): int
352352
{
353353
error_clear_last();
354-
if ($offset !== 0) {
355-
$result = \preg_match_all($pattern, $subject, $matches, $flags, $offset);
356-
} elseif ($flags !== PREG_PATTERN_ORDER) {
357-
$result = \preg_match_all($pattern, $subject, $matches, $flags);
358-
} elseif ($matches !== null) {
359-
$result = \preg_match_all($pattern, $subject, $matches);
360-
} else {
361-
$result = \preg_match_all($pattern, $subject);
362-
}
354+
$result = \preg_match_all($pattern, $subject, $matches, $flags, $offset);
363355
if ($result === false) {
364356
throw PcreException::createFromPhpError();
365357
}
@@ -596,15 +588,7 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null
596588
function preg_match(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int
597589
{
598590
error_clear_last();
599-
if ($offset !== 0) {
600-
$result = \preg_match($pattern, $subject, $matches, $flags, $offset);
601-
} elseif ($flags !== 0) {
602-
$result = \preg_match($pattern, $subject, $matches, $flags);
603-
} elseif ($matches !== null) {
604-
$result = \preg_match($pattern, $subject, $matches);
605-
} else {
606-
$result = \preg_match($pattern, $subject);
607-
}
591+
$result = \preg_match($pattern, $subject, $matches, $flags, $offset);
608592
if ($result === false) {
609593
throw PcreException::createFromPhpError();
610594
}

generated/sem.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ function msg_queue_exists(int $key): void
9595
function msg_receive($queue, int $desiredmsgtype, int &$msgtype, int $maxsize, &$message, bool $unserialize = true, int $flags = 0, int &$errorcode = null): void
9696
{
9797
error_clear_last();
98-
if ($errorcode !== null) {
99-
$result = \msg_receive($queue, $desiredmsgtype, $msgtype, $maxsize, $message, $unserialize, $flags, $errorcode);
100-
} else {
101-
$result = \msg_receive($queue, $desiredmsgtype, $msgtype, $maxsize, $message, $unserialize, $flags);
102-
}
98+
$result = \msg_receive($queue, $desiredmsgtype, $msgtype, $maxsize, $message, $unserialize, $flags, $errorcode);
10399
if ($result === false) {
104100
throw SemException::createFromPhpError();
105101
}
@@ -158,11 +154,7 @@ function msg_remove_queue($queue): void
158154
function msg_send($queue, int $msgtype, $message, bool $serialize = true, bool $blocking = true, int &$errorcode = null): void
159155
{
160156
error_clear_last();
161-
if ($errorcode !== null) {
162-
$result = \msg_send($queue, $msgtype, $message, $serialize, $blocking, $errorcode);
163-
} else {
164-
$result = \msg_send($queue, $msgtype, $message, $serialize, $blocking);
165-
}
157+
$result = \msg_send($queue, $msgtype, $message, $serialize, $blocking, $errorcode);
166158
if ($result === false) {
167159
throw SemException::createFromPhpError();
168160
}

0 commit comments

Comments
 (0)