Issues (172)

src/functions/iterable_concat.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Improved;
6
7
/**
8
 * Concatenate all elements into a single string.
9
 *
10
 * @param iterable $iterable
11
 * @param string   $glue
12
 * @return string
13
 */
14
function iterable_concat(iterable $iterable, string $glue = ''): string
0 ignored issues
show
Function Improved\iterable_concat() has parameter $iterable with no value type specified in iterable type iterable.
Loading history...
15
{
16 9
    $string = "";
17
18 9
    foreach ($iterable as $item) {
19 8
        $string .= $item . $glue;
20
    }
21
22 9
    return $glue === "" ? $string : substr($string, 0, -1 * strlen($glue));
23
}
24