code: protected function backtraceRemoveInternal($backtrace)
      {
          for ($i = \count($backtrace) - 1; $i > 0; $i--) {
              $frame = $backtrace[$i];
              if (isset($frame['class']) && $frame['class'] === __CLASS__) {
                  break;
              }
          }
          if ($backtrace[$i]['function'] == 'onShutdown') {
              /*
                  We got here via php.shutdown event (fatal error)
                  skip over PubSub internals
              */
              $refObj = new ReflectionObject($this->eventManager);
              $filepath = $refObj->getFilename();
              while (isset($backtrace[$i+1]['file']) && $backtrace[$i+1]['file'] == $filepath) {
                  $i++;
              }
          }
          $i++;
          return \array_slice($backtrace, $i);
      }
docs: Remove internal frames from backtrace
  
  @param array $backtrace backtrace
  
  @return array