original_string: public static function __callHandler($index, $value, array $handler)
      {
          /** @var PromiseInterface $promise */
          $promise = $handler[0];
  
          // The promise may have been cancelled or resolved before placing
          // this thunk in the queue.
          if ($promise->getState() !== self::PENDING) {
              return;
          }
  
          try {
              if (isset($handler[$index])) {
                  $promise->resolve(call_user_func($handler[$index], $value));
              } elseif ($index === 1) {
                  // Forward resolution values as-is.
                  $promise->resolve($value);
              } else {
                  // Forward rejections down the chain.
                  $promise->reject($value);
              }
          } catch (\Throwable $reason) {
              $promise->reject($reason);
          } catch (\Exception $reason) {
              $promise->reject($reason);
          }
      }
code: public static function __callHandler($index, $value, array $handler)
      {
          /** @var PromiseInterface $promise */
          $promise = $handler[0];
  
          // The promise may have been cancelled or resolved before placing
          // this thunk in the queue.
          if ($promise->getState() !== self::PENDING) {
              return;
          }
  
          try {
              if (isset($handler[$index])) {
                  $promise->resolve(call_user_func($handler[$index], $value));
              } elseif ($index === 1) {
                  // Forward resolution values as-is.
                  $promise->resolve($value);
              } else {
                  // Forward rejections down the chain.
                  $promise->reject($value);
              }
          } catch (\Throwable $reason) {
              $promise->reject($reason);
          } catch (\Exception $reason) {
              $promise->reject($reason);
          }
      }
code_tokens: public static function __callHandler ( $ index , $ value , array $ handler ) { /** @var PromiseInterface $promise */ $ promise = $ handler [ 0 ] ; // The promise may have been cancelled or resolved before placing // this thunk in the queue. if ( $ promise -> getState ( ) !== self :: PENDING ) { return ; } try { if ( isset ( $ handler [ $ index ] ) ) { $ promise -> resolve ( call_user_func ( $ handler [ $ index ] , $ value ) ) ; } elseif ( $ index === 1 ) { // Forward resolution values as-is. $ promise -> resolve ( $ value ) ; } else { // Forward rejections down the chain. $ promise -> reject ( $ value ) ; } } catch ( \ Throwable $ reason ) { $ promise -> reject ( $ reason ) ; } catch ( \ Exception $ reason ) { $ promise -> reject ( $ reason ) ; } }
docstring: Call a stack of handlers using a specific callback index and value.
  
  @internal
  
  @param int   $index   1 (resolve) or 2 (reject).
  @param mixed $value   Value to pass to the callback.
  @param array $handler Array of handler data (promise and callbacks).
  
  @return array Returns the next group to resolve.
docstring_tokens: Call a stack of handlers using a specific callback index and value .