original_string: public function replaceByIndex($offset, $name = null)
      {
          if (!isset($this->elements[$offset])) {
              throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
          }
  
          if (null !== $name) {
              $this->elements[$offset] = $name;
          }
  
          $this->isIndex[$offset] = true;
      }
code: public function replaceByIndex($offset, $name = null)
      {
          if (!isset($this->elements[$offset])) {
              throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
          }
  
          if (null !== $name) {
              $this->elements[$offset] = $name;
          }
  
          $this->isIndex[$offset] = true;
      }
code_tokens: public function replaceByIndex ( $ offset , $ name = null ) { if ( ! isset ( $ this -> elements [ $ offset ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The offset %s is not within the property path' , $ offset ) ) ; } if ( null !== $ name ) { $ this -> elements [ $ offset ] = $ name ; } $ this -> isIndex [ $ offset ] = true ; }
docstring: Replaces a property element by an index element.
  
  @param int    $offset The offset at which to replace
  @param string $name   The new name of the element. Optional
  
  @throws OutOfBoundsException If the offset is invalid
docstring_tokens: Replaces a property element by an index element .