{@inheritdoc}

@return self
188020
public function replace($search, $replace): Comment
    {
        $lines = $this->getLines();

        array_walk($lines, function (&$line) use ($search, $replace) {
            $line = str_replace($search, $replace, $line);
        });

        return $this->setLines($lines);
    }
979744
public function withParameters(array $parameters): self
    {
        $query = $this;

        foreach ($parameters as $key => $parameter) {
            $query = $query->withParameter($key, $parameter);
        }

        return $query;
    }
86034
public function set($key, $value): self
    {
        if ($key === null) { // $x[] = ..
            $this->data[] = $value;
        } else {
            Arrays::set($this->data, $key, $value);
        }

        return $this;
    }
487179
protected function cleanCollection() : self {
      foreach ($this as $index => $token) {
        if ($token->isValid()) {
          continue;
        }
        unset($this->items[$index]);
      }

      return $this;
    }
387307
public function load(): self
    {
        $this->loader = new Loader($this->files, true);
        $this->loader->load();

        return $this;
    }
747943
public function finalize(): self
    {
        if (!$this->isFinalized) {
            $this->normalizeDefinition();
            $this->isFinalized = true;
            $this->definition = new MockDefinition(
                $this->types,
                $this->customMethods,
                $this->customProperties,
                $this->customStaticMethods,
                $this->customStaticProperties,
                $this->customConstants,
                $this->className
            );
        }

        return $this;
    }
403125
public function scope(...$scopes): self
    {
        $this->scopes = \array_merge($this->scopes, $scopes);

        return $this;
    }
51250
public function refresh() : self {
      $newCode = $this->collection->assemble();
      $tokens = Helper::getTokensFromString($newCode);

      $this->collection->setItems($tokens);
      return $this;
    }
351221
public function with(ObjectInterface $object): self
    {
        $clone = clone $this;
        $clone->objects[$object->getId()] = $object;
        $clone->array[$object->getId()] = $object->getInstance();

        return $clone;
    }
628938
public function simplify(): self {
        $this->index_code =
            $this->tmp_tree =
            $this->word_states =
            $this->begin_used = [];
        $this->index_count = 0;
        return $this;
    }
942680
public function fields( $fields )
	{
		if ( !is_array( $fields ) && !is_null( $fields ) )
		{
			$fields = array( $fields );
		}
		
		// do nothing if we get nothing
		if ( empty( $fields ) || $fields == array( '*' ) )
		{
			$this->fields = array(); return $this;
		}
		
		$this->fields = $fields;

		// return self so we can continue running the next function
		return $this;
	}
133237
protected function requireFiles(): self
    {
        foreach ($this->_finders as $finder)
        {
            foreach ($finder as $file)
            {
                require_once $file->getRealpath();
            }
        }

        return $this;
    }
93123
public function clear() {
		$this->_value = null;
		$this->getConnection()->getClient()->delete($this->name);
		return $this;
	}
1354675
public function on() : self
    {
        $this->handler->setErrorHandler();
        $this->handler->setExceptionHandler();
        $this->handler->setFatalHandler();

        return $this;
    }
1110502
public function remove() : self {
      $this->type = static::INVALID_TYPE;
      $this->value = static::INVALID_VALUE;
      $this->line = static::INVALID_LINE;
      $this->index = static::INVALID_INDEX;
      return $this;
    }
1025383
public function setType($type): self
    {
        if ($type instanceof Type) {
            $this->setIndex($type->getIndex()->getName());
            $type = $type->getName();
        }

        $this->_type = (string) $type;

        return $this;
    }
413568
public function resolve($response = null): self
    {
        if ($this->exception instanceof \Throwable) {
            throw $this->exception;
        }

        if ($this->mustBeResolved($response)) {
            $this->value = $response;
        }

        $this->locked = false;

        return $this;
    }