Reference

$file->hasNext()

Checks if there's a next item in the collection

$file->hasNext(): bool

Return type

bool

Example

$file = $page->file('myfile.pdf');

if($file && $file->hasNext()) {
    echo 'Next file: ' . $file->next()->filename();
}

Source code

kirby/src/Cms/HasSiblings.php#L89