MatchNoneConstraint.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /*
  3. * This file is part of composer/semver.
  4. *
  5. * (c) Composer <https://github.com/composer>
  6. *
  7. * For the full copyright and license information, please view
  8. * the LICENSE file that was distributed with this source code.
  9. */
  10. namespace Composer\Semver\Constraint;
  11. /**
  12. * Blackhole of constraints, nothing escapes it
  13. */
  14. class MatchNoneConstraint implements ConstraintInterface
  15. {
  16. /** @var string|null */
  17. protected $prettyString;
  18. /**
  19. * @param ConstraintInterface $provider
  20. *
  21. * @return bool
  22. */
  23. public function matches(ConstraintInterface $provider)
  24. {
  25. return false;
  26. }
  27. /**
  28. * {@inheritDoc}
  29. */
  30. public function compile($otherOperator)
  31. {
  32. return 'false';
  33. }
  34. /**
  35. * {@inheritDoc}
  36. */
  37. public function setPrettyString($prettyString)
  38. {
  39. $this->prettyString = $prettyString;
  40. }
  41. /**
  42. * {@inheritDoc}
  43. */
  44. public function getPrettyString()
  45. {
  46. if ($this->prettyString) {
  47. return $this->prettyString;
  48. }
  49. return (string) $this;
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public function __toString()
  55. {
  56. return '[]';
  57. }
  58. /**
  59. * {@inheritDoc}
  60. */
  61. public function getUpperBound()
  62. {
  63. return new Bound('0.0.0.0-dev', false);
  64. }
  65. /**
  66. * {@inheritDoc}
  67. */
  68. public function getLowerBound()
  69. {
  70. return new Bound('0.0.0.0-dev', false);
  71. }
  72. }