Skip to content

Commit 2294511

Browse files
committed
Use of null coalesce operator, that comes with PHP7.1
1 parent 8cc5fa1 commit 2294511

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/String/truncate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function truncate($string, array $options = [])
101101
$newEnd = \end($match[0])[1];
102102
}
103103

104-
$result = \substr($result, 0, null === $newEnd ? $end : $newEnd);
104+
$result = \substr($result, 0, $newEnd ?? $end);
105105
}
106106
} elseif (\strpos($string, $separator) !== $end) {
107107
$index = \strrpos($result, $separator);

src/internal/castSlice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
function castSlice(array $array, int $start, ?int $end = null): array
2626
{
2727
$length = \count($array);
28-
$end = null === $end ? $length : $end;
28+
$end = $end ?? $length;
2929

3030
return (!$start && $end >= $length) ? $array : \array_slice($array, $start, $end);
3131
}

0 commit comments

Comments
 (0)