ParametersMatch.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of PHPUnit.
  4. *
  5. * This file is modified to replace the Match interface with ParametersMatch,
  6. * to avoid parse errors due to `match` being a reserved keyword in PHP 8.
  7. *
  8. * When the test suite is updated for compatibility with PHPUnit 9.x,
  9. * this override can be removed.
  10. *
  11. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  12. *
  13. * For the full copyright and license information, please view the LICENSE
  14. * file that was distributed with this source code.
  15. */
  16. namespace PHPUnit\Framework\MockObject\Builder;
  17. use PHPUnit\Framework\MockObject\Matcher\AnyParameters;
  18. /**
  19. * Builder interface for parameter matchers.
  20. */
  21. interface ParametersMatch extends Stub
  22. {
  23. /**
  24. * Defines the expectation which must occur before the current is valid.
  25. *
  26. * @param string $id the identification of the expectation that should
  27. * occur before this one
  28. *
  29. * @return Stub
  30. */
  31. public function after($id);
  32. /**
  33. * Sets the parameters to match for, each parameter to this function will
  34. * be part of match. To perform specific matches or constraints create a
  35. * new PHPUnit\Framework\Constraint\Constraint and use it for the parameter.
  36. * If the parameter value is not a constraint it will use the
  37. * PHPUnit\Framework\Constraint\IsEqual for the value.
  38. *
  39. * Some examples:
  40. * <code>
  41. * // match first parameter with value 2
  42. * $b->with(2);
  43. * // match first parameter with value 'smock' and second identical to 42
  44. * $b->with('smock', new PHPUnit\Framework\Constraint\IsEqual(42));
  45. * </code>
  46. *
  47. * @return ParametersMatch
  48. */
  49. public function with(...$arguments);
  50. /**
  51. * Sets a matcher which allows any kind of parameters.
  52. *
  53. * Some examples:
  54. * <code>
  55. * // match any number of parameters
  56. * $b->withAnyParameters();
  57. * </code>
  58. *
  59. * @return AnyParameters
  60. */
  61. public function withAnyParameters();
  62. }