title: PHPUnit withConsecutive strange behaviour
body: <p>Consider the next test:</p>
  
  <pre class="lang-php prettyprint-override"><code>class User
  {
  }
  
  class UserRepository
  {
      public function getByName($name)
      {
      }
  
      public function getByUser(User $user)
      {
      }
  }
  
  class UserController
  {
      private $userRepository;
  
      public function __construct(UserRepository $userRepository)
      {
          $this-&gt;userRepository = $userRepository;
      }
  
      public function findByNames($name1, $name2)
      {
          $this-&gt;userRepository-&gt;getByName($name1);
          $this-&gt;userRepository-&gt;getByName($name2);
      }
  
      public function findByUsers($user1, $user2)
      {
          $this-&gt;userRepository-&gt;getByUser($user1);
          $this-&gt;userRepository-&gt;getByUser($user2);
      }
  }
  
  class WithConsecutiveTest extends \PHPUnit_Framework_TestCase
  {
      /**
       * This test is fails if some of "Alice" or "Bob" string changed. This is expected behaviour.
       */
      public function testWithConsecutiveOnStrings()
      {
          $name1 = 'Alice';
          $name2 = 'Bob';
  
          $userRepository = $this-&gt;createMock(UserRepository::class);
  
          $userRepository
              -&gt;expects($this-&gt;exactly(2))
              -&gt;method('getByName')
              -&gt;withConsecutive(
                  [$name1], // change to $name2 and test fails
                  [$name2]
              );
  
          $userController = new UserController($userRepository);
          $userController-&gt;findByNames($name1, $name2);
      }
  
      /**
       * This test is NOT fails if in "withConsecutive()" call $user1 changed to $user2. This is unexpected behaviour.
       */
      public function testWithConsecutiveOnObjects()
      {
          $user1 = $this-&gt;createMock(User::class);
          $user2 = $this-&gt;createMock(User::class);
  
          $this-&gt;assertEquals($user1, $user2);
          $this-&gt;assertNotSame($user1, $user2);
  
          $userRepository = $this-&gt;createMock(UserRepository::class);
  
          $userRepository
              -&gt;expects($this-&gt;exactly(2))
              -&gt;method('getByUser')
              -&gt;withConsecutive(
                  [$user1], // change to $user2 and test is also passed
                  [$user2]
              );
  
          $userController = new UserController($userRepository);
          $userController-&gt;findByUsers($user1, $user2);
      }
  }
  </code></pre>
  
  <p>First test with string arguments for "withConsecutive()" is works correctly, but second test with objects do some magic: something similar to weak comparison of two objects is here, so second test is passed in any case.</p>
  
  <p>I tried with "[$this->callback(function($user1arg) use ($user1)){return $user1arg === $user1}]" constraint - this works well, but write a lot of this constraint is a some kind of monkey job.</p>
  
  <p>Maybe it may have a more simple solution, instead of writing a lot of constraints with $this->callback(...) for objects?</p>