Bound.php
1 year ago
Constraint.php
1 year ago
ConstraintInterface.php
1 year ago
MatchAllConstraint.php
1 year ago
MatchNoneConstraint.php
1 year ago
MultiConstraint.php
1 year ago
ConstraintInterface.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of composer/semver. |
| 5 | * |
| 6 | * (c) Composer <https://github.com/composer> |
| 7 | * |
| 8 | * For the full copyright and license information, please view |
| 9 | * the LICENSE file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Composer\Semver\Constraint; |
| 13 | |
| 14 | /** |
| 15 | * DO NOT IMPLEMENT this interface. It is only meant for usage as a type hint |
| 16 | * in libraries relying on composer/semver but creating your own constraint class |
| 17 | * that implements this interface is not a supported use case and will cause the |
| 18 | * composer/semver components to return unexpected results. |
| 19 | */ |
| 20 | interface ConstraintInterface |
| 21 | { |
| 22 | /** |
| 23 | * Checks whether the given constraint intersects in any way with this constraint |
| 24 | * |
| 25 | * @param ConstraintInterface $provider |
| 26 | * |
| 27 | * @return bool |
| 28 | */ |
| 29 | public function matches(ConstraintInterface $provider); |
| 30 | |
| 31 | /** |
| 32 | * Provides a compiled version of the constraint for the given operator |
| 33 | * The compiled version must be a PHP expression. |
| 34 | * Executor of compile version must provide 2 variables: |
| 35 | * - $v = the string version to compare with |
| 36 | * - $b = whether or not the version is a non-comparable branch (starts with "dev-") |
| 37 | * |
| 38 | * @see Constraint::OP_* for the list of available operators. |
| 39 | * @example return '!$b && version_compare($v, '1.0', '>')'; |
| 40 | * |
| 41 | * @param int $otherOperator one Constraint::OP_* |
| 42 | * |
| 43 | * @return string |
| 44 | * |
| 45 | * @phpstan-param Constraint::OP_* $otherOperator |
| 46 | */ |
| 47 | public function compile($otherOperator); |
| 48 | |
| 49 | /** |
| 50 | * @return Bound |
| 51 | */ |
| 52 | public function getUpperBound(); |
| 53 | |
| 54 | /** |
| 55 | * @return Bound |
| 56 | */ |
| 57 | public function getLowerBound(); |
| 58 | |
| 59 | /** |
| 60 | * @return string |
| 61 | */ |
| 62 | public function getPrettyString(); |
| 63 | |
| 64 | /** |
| 65 | * @param string|null $prettyString |
| 66 | * |
| 67 | * @return void |
| 68 | */ |
| 69 | public function setPrettyString($prettyString); |
| 70 | |
| 71 | /** |
| 72 | * @return string |
| 73 | */ |
| 74 | public function __toString(); |
| 75 | } |
| 76 |