Checked errors
Use throws to tell callers which failures they need to handle. Anyone calling loadUser must catch UserNotFound and StorageFailure, or declare them on their own function so its caller can handle them:
users.ppphp
function loadUser(string $id): string
throws UserNotFound, StorageFailure
The caller in the editor handles UserNotFound but forgets StorageFailure. Press Check to see the compiler catch it, then add the missing catch block after the first one:
users.ppphp
} catch (StorageFailure $error) {
echo 'unavailable';
}
Check again and the file passes. Press Run to print maya, then try an empty ID to see the UserNotFound catch print guest. These are ordinary PHP exceptions; throws helps you catch a forgotten handler before the program runs.