mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
Utils::pregSplit: limit is not nullable
Correctly flagged by Psalm: ``` ERROR: PossiblyNullArgument - src\Utils.php:50:53 - Argument 3 of preg_split cannot be null, possibly null value provided (see https://psalm.dev/078) $parts = php_preg_split($pattern, $subject, $limit, $flags); ``` The `$limit` argument of the PHP native `preg_split()` function is not nullable. Ref: https://www.php.net/manual/en/function.preg-split
This commit is contained in:
+2
-2
@@ -29,7 +29,7 @@ abstract class Utils
|
||||
*
|
||||
* @param string $pattern The pattern to search for, as a string.
|
||||
* @param string $subject The input string.
|
||||
* @param int|null $limit If specified, then only substrings up to limit are returned with the
|
||||
* @param int $limit If specified, then only substrings up to limit are returned with the
|
||||
* rest of the string being placed in the last substring. A limit of -1 or 0 means "no limit".
|
||||
* @param int $flags flags can be any combination of the following flags (combined with the | bitwise operator):
|
||||
* *PREG_SPLIT_NO_EMPTY*
|
||||
@@ -46,7 +46,7 @@ abstract class Utils
|
||||
*
|
||||
* @throws PcreException
|
||||
*/
|
||||
public static function pregSplit(string $pattern, string $subject, ?int $limit = -1, int $flags = 0): array
|
||||
public static function pregSplit(string $pattern, string $subject, int $limit = -1, int $flags = 0) : array
|
||||
{
|
||||
$parts = php_preg_split($pattern, $subject, $limit, $flags);
|
||||
if ($parts === false) {
|
||||
|
||||
Reference in New Issue
Block a user