Skip to content

Commit

Permalink
Merge d3d6bdf into 071c938
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharhamel committed Oct 15, 2019
2 parents 071c938 + d3d6bdf commit 1d9be1f
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 3 deletions.
6 changes: 4 additions & 2 deletions generated/apcu.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,19 @@ function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl =
* string for a single key,
* or as an array of strings for several keys,
* or as an APCUIterator object.
* @return bool|array Returns TRUE on success.
* @return bool|array If key is an array, an indexed array of the keys is returned.
* Otherwise TRUE is returned on success.
* @throws ApcuException
*
*/
function apcu_delete($key): void
function apcu_delete($key)
{
error_clear_last();
$result = \apcu_delete($key);
if ($result === false) {
throw ApcuException::createFromPhpError();
}
return $result;
}


Expand Down
75 changes: 75 additions & 0 deletions generated/array.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,81 @@ function array_multisort(array &$array1, $array1_sort_order = SORT_ASC, $array1_
}


/**
* array_replace_recursive replaces the values of
* array1 with the same values from all the following
* arrays. If a key from the first array exists in the second array, its value
* will be replaced by the value from the second array. If the key exists in the
* second array, and not the first, it will be created in the first array.
* If a key only exists in the first array, it will be left as is.
* If several arrays are passed for replacement, they will be processed
* in order, the later array overwriting the previous values.
*
* array_replace_recursive is recursive : it will recurse into
* arrays and apply the same process to the inner value.
*
* When the value in the first array is scalar, it will be replaced
* by the value in the second array, may it be scalar or array.
* When the value in the first array and the second array
* are both arrays, array_replace_recursive will replace
* their respective value recursively.
*
* @param array $array1 The array in which elements are replaced.
* @param array $params Optional. Arrays from which elements will be extracted.
* @return array Returns an array, or NULL if an error occurs.
* @throws ArrayException
*
*/
function array_replace_recursive(array $array1, array ...$params): array
{
error_clear_last();
if ($params !== []) {
$result = \array_replace_recursive($array1, ...$params);
} else {
$result = \array_replace_recursive($array1);
}
if ($result === null) {
throw ArrayException::createFromPhpError();
}
return $result;
}


/**
* array_replace replaces the values of
* array1 with values having the same keys in each of the following
* arrays. If a key from the first array exists in the second array, its value
* will be replaced by the value from the second array. If the key exists in the
* second array, and not the first, it will be created in the first array.
* If a key only exists in the first array, it will be left as is.
* If several arrays are passed for replacement, they will be processed
* in order, the later arrays overwriting the previous values.
*
* array_replace is not recursive : it will replace
* values in the first array by whatever type is in the second array.
*
* @param array $array1 The array in which elements are replaced.
* @param array $params Arrays from which elements will be extracted.
* Values from later arrays overwrite the previous values.
* @return array Returns an array, or NULL if an error occurs.
* @throws ArrayException
*
*/
function array_replace(array $array1, array ...$params): array
{
error_clear_last();
if ($params !== []) {
$result = \array_replace($array1, ...$params);
} else {
$result = \array_replace($array1);
}
if ($result === null) {
throw ArrayException::createFromPhpError();
}
return $result;
}


/**
* Applies the user-defined callback function to each
* element of the array. This function will recurse
Expand Down
2 changes: 1 addition & 1 deletion generated/eio.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function eio_busy(int $delay, int $pri = EIO_PRI_DEFAULT, callable $callback = n


/**
* eio_chmod changes file, or direcrory permissions. The
* eio_chmod changes file, or directory permissions. The
* new permissions are specified by mode.
*
* @param string $path Path to the target file or directory
Expand Down
2 changes: 2 additions & 0 deletions generated/functionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'array_combine',
'array_flip',
'array_multisort',
'array_replace_recursive',
'array_replace',
'array_walk_recursive',
'arsort',
'asort',
Expand Down
3 changes: 3 additions & 0 deletions generator/src/DocPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ public function detectNullsyFunction(): bool
if (preg_match('/&null;\s+on\s+failure/', $file)) {
return true;
}
if (preg_match('/&null;\s+if\s+an\s+error\s+occurs/', $file)) {
return true;
}

return false;
}
Expand Down
2 changes: 2 additions & 0 deletions rector-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ services:
array_combine: 'Safe\array_combine'
array_flip: 'Safe\array_flip'
array_multisort: 'Safe\array_multisort'
array_replace_recursive: 'Safe\array_replace_recursive'
array_replace: 'Safe\array_replace'
array_walk_recursive: 'Safe\array_walk_recursive'
arsort: 'Safe\arsort'
asort: 'Safe\asort'
Expand Down

0 comments on commit 1d9be1f

Please sign in to comment.