code: public function hasBlock($name, array $context = null, array $blocks = array())
      {
          if (null === $context) {
              @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
  
              return isset($this->blocks[(string) $name]);
          }
  
          if (isset($blocks[$name])) {
              return $blocks[$name][0] instanceof self;
          }
  
          if (isset($this->blocks[$name])) {
              return true;
          }
  
          if (false !== $parent = $this->getParent($context)) {
              return $parent->hasBlock($name, $context);
          }
  
          return false;
      }
docs: Returns whether a block exists or not in the current context of the template.
  
  This method checks blocks defined in the current template
  or defined in "used" traits or defined in parent templates.
  
  @param string $name    The block name
  @param array  $context The context
  @param array  $blocks  The current set of blocks
  
  @return bool true if the block exists, false otherwise
  
  @internal