title: Trying to configure method "first" which cannot be configured because it does not exist, has not been specified, is final, or is static
body: <p>I'll try to create a mock objet to test my application and i've got an error thant i can't fix :</p>
  
  <pre><code>    $userOwnLevy = $this-&gt;createMock(User::class);
  
      $userHasContract = $this-&gt;createMock(UserHasContract::class);
      $userHasContract-&gt;method('getUser')-&gt;willReturn($userOwnLevy);
  
      $firstUserHasContract = $this
          -&gt;getMockBuilder(UserHasContract::class)
          -&gt;getMock()
          -&gt;method('first')
          -&gt;willReturn($userHasContract);
  
      $contract = $this-&gt;createMock(Contract::class);
      $contract-&gt;method('getUserHasContract')-&gt;willReturnMap([$firstUserHasContract]);
  
      $levy = $this-&gt;createMock(Levy::class);
      $levy-&gt;method('getContract')-&gt;willReturn($contract);
  </code></pre>
  
  <p>The goal is to mock this object :</p>
  
  <pre><code>$levy-&gt;getContract()-&gt;getUserHasContract()-&gt;first()-&gt;getUser();
  </code></pre>
  
  <p>I try this :</p>
  
  <pre><code>        $firstUserHasContract = $this
          -&gt;getMockBuilder(UserHasContract::class)
          -&gt;setMethods(['first'])
          -&gt;getMock()
          -&gt;method('first')
          -&gt;willReturn($userHasContract);
  </code></pre>
  
  <p>But i got this error </p>
  
  <pre><code>Call to a member function first() on null
  </code></pre>
  
  <p>So if everyone could help me to understand ? 
  Thanks by advance </p>