src/Socket/SocketErrorHandler.php
public function getErrorLevel(int $operation): int
    {
        if (!is_resource($this->socket) || !get_resource_type($this->socket) === 'Socket') {
            $errno = SOCKET_EPIPE;
        } else {
            $errno = socket_last_error($this->socket);
        }
        if ($errno === 0) {
            return self::ERROR_NOTHING;
        } elseif (isset(self::$catchableErrors[$errno])) {
            if (
                self::$catchableErrors[$errno] !== self::ERROR_NOTHING
                && self::$catchableErrors[$errno] !== self::ERROR_AGAIN // for unix-like systems
            ) {
                Log::log(sprintf(
                    'Socket catch error %s at %s: %d',
                    socket_strerror($errno),
                    $operation ? 'WRITING' : 'READING',
                    $errno
                ));
            }
            return self::$catchableErrors[$errno];
        } else {
            Log::log(sprintf('Unknown socket error %d: %s', $errno, socket_strerror($errno)));
            return self::ERROR_UNKNOWN;
        }
    }
public function getErrorLevel(int $operation): int
    {
        if (!is_resource($this->socket) || !get_resource_type($this->socket) === 'Socket') {
            $errno = SOCKET_EPIPE;
        } else {
            $errno = socket_last_error($this->socket);
        }
        if ($errno === 0) {
            return self::ERROR_NOTHING;
        } elseif (isset(self::$catchableErrors[$errno])) {
            if (
                self::$catchableErrors[$errno] !== self::ERROR_NOTHING
                && self::$catchableErrors[$errno] !== self::ERROR_AGAIN // for unix-like systems
            ) {
                Log::log(sprintf(
                    'Socket catch error %s at %s: %d',
                    socket_strerror($errno),
                    $operation ? 'WRITING' : 'READING',
                    $errno
                ));
            }
            return self::$catchableErrors[$errno];
        } else {
            Log::log(sprintf('Unknown socket error %d: %s', $errno, socket_strerror($errno)));
            return self::ERROR_UNKNOWN;
        }
    }
Функция возвращает одну из констант self::ERROR_*
Параметр $operation - номер операции; 1 = запись, 0 = чтение.

@param int $operation

@return int