function split_with_possibly_negative_limit()

in src/legacy_fixme/str.php [61:79]


function split_with_possibly_negative_limit(
  string $string,
  string $delimiter,
  ?int $limit = null,
)[]: vec<string> {
 if ($delimiter !== '' && $limit is int && $limit < 0) {
   $full = Str\split($string, $delimiter);
   $limit += C\count($full);
   if ($limit <= 0) {
     return vec[];
   }
   return Vec\take($full, $limit);
 }
 return Str\split(
   $string,
   $delimiter,
   $limit,
  );
}