src/Stub/StubData.php
public function closeRule(): Stub
    {
        if (!empty($this->secondaryRequests)) {
            $defaultAnswerCallback = $this->defaultAnswerCallback;
            $defaultAnswerCallback($this);
            $this->secondaryRequests = [];
        }

        if (!empty($this->answers)) {
            if (null !== $this->criteria) {
                $rule = new StubRule($this->criteria, $this->answers);

                $this->criteria = null;
            } else {
                $rule = new StubRule(
                    [$this->matcherFactory->wildcard()],
                    $this->answers
                );
            }

            array_unshift($this->rules, $rule);
            $this->answers = [];
        }

        if (null !== $this->criteria) {
            $criteria = $this->criteria;
            $this->criteria = null;

            throw new UnusedStubCriteriaException($criteria);
        }

        return $this;
    }
public function closeRule(): Stub
    {
        if (!empty($this->secondaryRequests)) {
            $defaultAnswerCallback = $this->defaultAnswerCallback;
            $defaultAnswerCallback($this);
            $this->secondaryRequests = [];
        }

        if (!empty($this->answers)) {
            if (null !== $this->criteria) {
                $rule = new StubRule($this->criteria, $this->answers);

                $this->criteria = null;
            } else {
                $rule = new StubRule(
                    [$this->matcherFactory->wildcard()],
                    $this->answers
                );
            }

            array_unshift($this->rules, $rule);
            $this->answers = [];
        }

        if (null !== $this->criteria) {
            $criteria = $this->criteria;
            $this->criteria = null;

            throw new UnusedStubCriteriaException($criteria);
        }

        return $this;
    }
public function closeRule ( ) : Stub { if ( ! empty ( $ this -> secondaryRequests ) ) { $ defaultAnswerCallback = $ this -> defaultAnswerCallback ; $ defaultAnswerCallback ( $ this ) ; $ this -> secondaryRequests = [ ] ; } if ( ! empty ( $ this -> answers ) ) { if ( null !== $ this -> criteria ) { $ rule = new StubRule ( $ this -> criteria , $ this -> answers ) ; $ this -> criteria = null ; } else { $ rule = new StubRule ( [ $ this -> matcherFactory -> wildcard ( ) ] , $ this -> answers ) ; } array_unshift ( $ this -> rules , $ rule ) ; $ this -> answers = [ ] ; } if ( null !== $ this -> criteria ) { $ criteria = $ this -> criteria ; $ this -> criteria = null ; throw new UnusedStubCriteriaException ( $ criteria ) ; } return $ this ; }
Close any existing rule.

@return $this This stub.
Close any existing rule .