code: public static function detectBlockType(Token $token)
      {
          foreach (self::getBlockEdgeDefinitions() as $type => $definition) {
              if ($token->equals($definition['start'])) {
                  return ['type' => $type, 'isStart' => true];
              }
  
              if ($token->equals($definition['end'])) {
                  return ['type' => $type, 'isStart' => false];
              }
          }
      }
docs: Detect type of block.
  
  @param Token $token token
  
  @return null|array array with 'type' and 'isStart' keys or null if not found