Skip to content

Commit

Permalink
Merge pull request codeigniter4#7612 from ping-yee/230624_mix_in_helpers
Browse files Browse the repository at this point in the history
docs: Replace type `mixed` in all helper files.
  • Loading branch information
kenjis authored Jul 3, 2023
2 parents 89292d8 + 95cf346 commit 311d66e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ parameters:
count: 1
path: system/Helpers/filesystem_helper.php

-
message: "#^Binary operation \"\\+\" between 0 and string results in an error\\.$#"
count: 1
path: system/Helpers/number_helper.php

-
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#"
count: 1
Expand Down
6 changes: 3 additions & 3 deletions system/Helpers/array_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function dot_array_search(string $index, array $array)
*
* @internal This should not be used on its own.
*
* @return mixed
* @return array|bool|float|int|object|string|null
*/
function _array_search_dot(array $indexes, array $array)
{
Expand Down Expand Up @@ -103,9 +103,9 @@ function _array_search_dot(array $indexes, array $array)
/**
* Returns the value of an element at a key in an array of uncertain depth.
*
* @param mixed $key
* @param int|string $key
*
* @return mixed|null
* @return array|bool|float|int|object|string|null
*/
function array_deep_search($key, array $array)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/cookie_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
/**
* Delete a cookie
*
* @param mixed $name
* @param string $name
* @param string $domain the cookie domain. Usually: .yourdomain.com
* @param string $path the cookie path
* @param string $prefix the cookie prefix
Expand Down
4 changes: 2 additions & 2 deletions system/Helpers/filesystem_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
* Returns false if the file cannot be found.
*
* @param string $file Path to file
* @param mixed $returnedValues Array or comma separated string of information returned
* @param string $file Path to file
* @param array|string $returnedValues Array or comma separated string of information returned
*
* @return array|null
*/
Expand Down
7 changes: 4 additions & 3 deletions system/Helpers/number_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/**
* Formats a numbers as bytes, based on size, and adds the appropriate suffix
*
* @param mixed $num Will be cast as int
* @param string $locale
* @param int|string $num Will be cast as int
* @param string $locale
*
* @return bool|string
*/
Expand Down Expand Up @@ -69,14 +69,15 @@ function number_to_size($num, int $precision = 1, ?string $locale = null)
*
* @see https://simple.wikipedia.org/wiki/Names_for_large_numbers
*
* @param string $num
* @param int|string $num
*
* @return bool|string
*/
function number_to_amount($num, int $precision = 0, ?string $locale = null)
{
// Strip any formatting & ensure numeric input
try {
// @phpstan-ignore-next-line
$num = 0 + str_replace(',', '', $num);
} catch (ErrorException $ee) {
return false;
Expand Down
12 changes: 6 additions & 6 deletions system/Helpers/text_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ function word_wrap(string $str, int $charlim = 76): string
*
* This function will strip tags from a string, split it at its max_length and ellipsize
*
* @param string $str String to ellipsize
* @param int $maxLength Max length of string
* @param mixed $position int (1|0) or float, .5, .2, etc for position to split
* @param string $ellipsis ellipsis ; Default '...'
* @param string $str String to ellipsize
* @param int $maxLength Max length of string
* @param float|int $position int (1|0) or float, .5, .2, etc for position to split
* @param string $ellipsis ellipsis ; Default '...'
*
* @return string Ellipsized string
*/
Expand Down Expand Up @@ -446,9 +446,9 @@ function ellipsize(string $str, int $maxLength, $position = 1, string $ellipsis
*
* Removes slashes contained in a string or in an array
*
* @param mixed $str string or array
* @param array|string $str string or array
*
* @return mixed string or array
* @return array|string string or array
*/
function strip_slashes($str)
{
Expand Down

0 comments on commit 311d66e

Please sign in to comment.