Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EventDriver.php

function EventDriver::__destruct

@codeCoverageIgnore

File

vendor/revolt/event-loop/src/EventLoop/Driver/EventDriver.php, line 77

Class

EventDriver

Namespace

Revolt\EventLoop\Driver

Code

public function __destruct() {
    foreach ($this->events as $event) {
        if ($event !== null) {
            // Events may have been nulled in extension depending on destruct order.
            $event->free();
        }
    }
    // Unset here, otherwise $event->del() fails with a warning, because __destruct order isn't defined.
    // See https://github.com/amphp/amp/issues/159.
    $this->events = [];
    // Manually free the loop handle to fully release loop resources.
    // See https://github.com/amphp/amp/issues/177.
    
    /** @psalm-suppress RedundantPropertyInitializationCheck */
    if (isset($this->handle)) {
        $this->handle
            ->free();
        unset($this->handle);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal