Signatur
try { … } catch (Throwable $e) { … } finally { … }
Beschreibung
Seit PHP 8.0 ist catch ohne Variable erlaubt: catch (SomeException). Mehrere Typen mit Union: catch (A|B $e).
Rückgabewert
Typ
void
Beispiele
Multi-Type
<?php
try {
riskyCall();
} catch (NetworkException | TimeoutException $e) {
logger()->warning($e->getMessage());
} finally {
cleanup();
}