Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use specific result variable name #377

Merged
merged 3 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions generated/apache.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
function apache_get_version(): string
{
error_clear_last();
$result = \apache_get_version();
if ($result === false) {
$safeResult = \apache_get_version();
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -35,11 +35,11 @@ function apache_get_version(): string
function apache_getenv(string $variable, bool $walk_to_top = false): string
{
error_clear_last();
$result = \apache_getenv($variable, $walk_to_top);
if ($result === false) {
$safeResult = \apache_getenv($variable, $walk_to_top);
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand Down Expand Up @@ -83,11 +83,11 @@ function apache_getenv(string $variable, bool $walk_to_top = false): string
function apache_lookup_uri(string $filename): object
{
error_clear_last();
$result = \apache_lookup_uri($filename);
if ($result === false) {
$safeResult = \apache_lookup_uri($filename);
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -102,11 +102,11 @@ function apache_lookup_uri(string $filename): object
function apache_request_headers(): array
{
error_clear_last();
$result = \apache_request_headers();
if ($result === false) {
$safeResult = \apache_request_headers();
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -121,11 +121,11 @@ function apache_request_headers(): array
function apache_response_headers(): array
{
error_clear_last();
$result = \apache_response_headers();
if ($result === false) {
$safeResult = \apache_response_headers();
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -143,8 +143,8 @@ function apache_response_headers(): array
function apache_setenv(string $variable, string $value, bool $walk_to_top = false): void
{
error_clear_last();
$result = \apache_setenv($variable, $value, $walk_to_top);
if ($result === false) {
$safeResult = \apache_setenv($variable, $value, $walk_to_top);
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
}
Expand All @@ -164,11 +164,11 @@ function apache_setenv(string $variable, string $value, bool $walk_to_top = fals
function getallheaders(): array
{
error_clear_last();
$result = \getallheaders();
if ($result === false) {
$safeResult = \getallheaders();
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -192,8 +192,8 @@ function getallheaders(): array
function virtual(string $uri): void
{
error_clear_last();
$result = \virtual($uri);
if ($result === false) {
$safeResult = \virtual($uri);
if ($safeResult === false) {
throw ApacheException::createFromPhpError();
}
}
28 changes: 14 additions & 14 deletions generated/apcu.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
function apcu_cache_info(bool $limited = false): array
{
error_clear_last();
$result = \apcu_cache_info($limited);
if ($result === false) {
$safeResult = \apcu_cache_info($limited);
if ($safeResult === false) {
throw ApcuException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -39,8 +39,8 @@ function apcu_cache_info(bool $limited = false): array
function apcu_cas(string $key, int $old, int $new): void
{
error_clear_last();
$result = \apcu_cas($key, $old, $new);
if ($result === false) {
$safeResult = \apcu_cas($key, $old, $new);
if ($safeResult === false) {
throw ApcuException::createFromPhpError();
}
}
Expand All @@ -61,11 +61,11 @@ function apcu_cas(string $key, int $old, int $new): void
function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
{
error_clear_last();
$result = \apcu_dec($key, $step, $success, $ttl);
if ($result === false) {
$safeResult = \apcu_dec($key, $step, $success, $ttl);
if ($safeResult === false) {
throw ApcuException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -84,11 +84,11 @@ function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl =
function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
{
error_clear_last();
$result = \apcu_inc($key, $step, $success, $ttl);
if ($result === false) {
$safeResult = \apcu_inc($key, $step, $success, $ttl);
if ($safeResult === false) {
throw ApcuException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -104,9 +104,9 @@ function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl =
function apcu_sma_info(bool $limited = false): array
{
error_clear_last();
$result = \apcu_sma_info($limited);
if ($result === false) {
$safeResult = \apcu_sma_info($limited);
if ($safeResult === false) {
throw ApcuException::createFromPhpError();
}
return $result;
return $safeResult;
}
10 changes: 5 additions & 5 deletions generated/array.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ function array_walk_recursive(&$array, callable $callback, $arg = null): void
{
error_clear_last();
if ($arg !== null) {
$result = \array_walk_recursive($array, $callback, $arg);
$safeResult = \array_walk_recursive($array, $callback, $arg);
} else {
$result = \array_walk_recursive($array, $callback);
$safeResult = \array_walk_recursive($array, $callback);
}
if ($result === false) {
if ($safeResult === false) {
throw ArrayException::createFromPhpError();
}
}
Expand All @@ -52,8 +52,8 @@ function array_walk_recursive(&$array, callable $callback, $arg = null): void
function shuffle(array &$array): void
{
error_clear_last();
$result = \shuffle($array);
if ($result === false) {
$safeResult = \shuffle($array);
if ($safeResult === false) {
throw ArrayException::createFromPhpError();
}
}
22 changes: 11 additions & 11 deletions generated/bzip2.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
function bzclose($bz): void
{
error_clear_last();
$result = \bzclose($bz);
if ($result === false) {
$safeResult = \bzclose($bz);
if ($safeResult === false) {
throw Bzip2Exception::createFromPhpError();
}
}
Expand All @@ -35,8 +35,8 @@ function bzclose($bz): void
function bzflush($bz): void
{
error_clear_last();
$result = \bzflush($bz);
if ($result === false) {
$safeResult = \bzflush($bz);
if ($safeResult === false) {
throw Bzip2Exception::createFromPhpError();
}
}
Expand All @@ -60,11 +60,11 @@ function bzflush($bz): void
function bzread($bz, int $length = 1024): string
{
error_clear_last();
$result = \bzread($bz, $length);
if ($result === false) {
$safeResult = \bzread($bz, $length);
if ($safeResult === false) {
throw Bzip2Exception::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -86,12 +86,12 @@ function bzwrite($bz, string $data, int $length = null): int
{
error_clear_last();
if ($length !== null) {
$result = \bzwrite($bz, $data, $length);
$safeResult = \bzwrite($bz, $data, $length);
} else {
$result = \bzwrite($bz, $data);
$safeResult = \bzwrite($bz, $data);
}
if ($result === false) {
if ($safeResult === false) {
throw Bzip2Exception::createFromPhpError();
}
return $result;
return $safeResult;
}
8 changes: 4 additions & 4 deletions generated/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ function unixtojd(int $timestamp = null): int
{
error_clear_last();
if ($timestamp !== null) {
$result = \unixtojd($timestamp);
$safeResult = \unixtojd($timestamp);
} else {
$result = \unixtojd();
$safeResult = \unixtojd();
}
if ($result === false) {
if ($safeResult === false) {
throw CalendarException::createFromPhpError();
}
return $result;
return $safeResult;
}
4 changes: 2 additions & 2 deletions generated/classobj.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
function class_alias(string $class, string $alias, bool $autoload = true): void
{
error_clear_last();
$result = \class_alias($class, $alias, $autoload);
if ($result === false) {
$safeResult = \class_alias($class, $alias, $autoload);
if ($safeResult === false) {
throw ClassobjException::createFromPhpError();
}
}
36 changes: 18 additions & 18 deletions generated/com.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
function com_create_guid(): string
{
error_clear_last();
$result = \com_create_guid();
if ($result === false) {
$safeResult = \com_create_guid();
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand Down Expand Up @@ -51,11 +51,11 @@ function com_event_sink(object $variant, object $sink_object, $sink_interface =
{
error_clear_last();
if ($sink_interface !== null) {
$result = \com_event_sink($variant, $sink_object, $sink_interface);
$safeResult = \com_event_sink($variant, $sink_object, $sink_interface);
} else {
$result = \com_event_sink($variant, $sink_object);
$safeResult = \com_event_sink($variant, $sink_object);
}
if ($result === false) {
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
Expand Down Expand Up @@ -116,8 +116,8 @@ function com_event_sink(object $variant, object $sink_object, $sink_interface =
function com_load_typelib(string $typelib, bool $case_insensitive = true): void
{
error_clear_last();
$result = \com_load_typelib($typelib, $case_insensitive);
if ($result === false) {
$safeResult = \com_load_typelib($typelib, $case_insensitive);
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
Expand All @@ -142,13 +142,13 @@ function com_print_typeinfo(object $variant, string $dispatch_interface = null,
{
error_clear_last();
if ($display_sink !== false) {
$result = \com_print_typeinfo($variant, $dispatch_interface, $display_sink);
$safeResult = \com_print_typeinfo($variant, $dispatch_interface, $display_sink);
} elseif ($dispatch_interface !== null) {
$result = \com_print_typeinfo($variant, $dispatch_interface);
$safeResult = \com_print_typeinfo($variant, $dispatch_interface);
} else {
$result = \com_print_typeinfo($variant);
$safeResult = \com_print_typeinfo($variant);
}
if ($result === false) {
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
Expand All @@ -167,11 +167,11 @@ function com_print_typeinfo(object $variant, string $dispatch_interface = null,
function variant_date_to_timestamp(object $variant): int
{
error_clear_last();
$result = \variant_date_to_timestamp($variant);
if ($result === null) {
$safeResult = \variant_date_to_timestamp($variant);
if ($safeResult === null) {
throw ComException::createFromPhpError();
}
return $result;
return $safeResult;
}


Expand All @@ -188,9 +188,9 @@ function variant_date_to_timestamp(object $variant): int
function variant_round($value, int $decimals)
{
error_clear_last();
$result = \variant_round($value, $decimals);
if ($result === null) {
$safeResult = \variant_round($value, $decimals);
if ($safeResult === null) {
throw ComException::createFromPhpError();
}
return $result;
return $safeResult;
}
Loading