Throwable::getPrevious

(PHP 7, PHP 8)

Throwable::getPreviousÖnceki Throwable sınıfıyla döner

Açıklama

public Throwable::getPrevious(): ?Throwable

Önceki herhangi bir Throwable'ı döndürür (örneğin, Exception::__construct()'a üçüncü bağımsız değişken olarak sağlanan).

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Varsa önceki Throwable'ı yoksa null döndürür.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
0
harry at upmind dot com
6 years ago
/**     * Gets sequential array of all previously-chained errors     *      * @param Throwable $error     *      * @return Throwable[]     */    function getChain(Throwable $error) : array    {        $chain = [];        do {            $chain[] = $error;        } while ($error = $error->getPrevious());        return $chain;    }
To Top