Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConstraintInterface.php

interface ConstraintInterface

Same name in this branch
  1. 11.1.x vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php \JsonSchema\Constraints\ConstraintInterface

DO NOT IMPLEMENT this interface. It is only meant for usage as a type hint in libraries relying on composer/semver but creating your own constraint class that implements this interface is not a supported use case and will cause the composer/semver components to return unexpected results.

Hierarchy

  • interface \Composer\Semver\Constraint\ConstraintInterface

Expanded class hierarchy of ConstraintInterface

All classes that implement ConstraintInterface

27 files declare their use of ConstraintInterface
AdvisoryProviderInterface.php in vendor/composer/composer/src/Composer/Repository/AdvisoryProviderInterface.php
ArrayRepository.php in vendor/composer/composer/src/Composer/Repository/ArrayRepository.php
CompilingMatcher.php in vendor/composer/semver/src/CompilingMatcher.php
ComposerRepository.php in vendor/composer/composer/src/Composer/Repository/ComposerRepository.php
IgnoredSecurityAdvisory.php in vendor/composer/composer/src/Composer/Advisory/IgnoredSecurityAdvisory.php

... See full list

File

vendor/composer/semver/src/Constraint/ConstraintInterface.php, line 20

Namespace

Composer\Semver\Constraint
View source
interface ConstraintInterface {
    
    /**
     * Checks whether the given constraint intersects in any way with this constraint
     *
     * @param ConstraintInterface $provider
     *
     * @return bool
     */
    public function matches(ConstraintInterface $provider);
    
    /**
     * Provides a compiled version of the constraint for the given operator
     * The compiled version must be a PHP expression.
     * Executor of compile version must provide 2 variables:
     * - $v = the string version to compare with
     * - $b = whether or not the version is a non-comparable branch (starts with "dev-")
     *
     * @see Constraint::OP_* for the list of available operators.
     * @example return '!$b && version_compare($v, '1.0', '>')';
     *
     * @param int $otherOperator one Constraint::OP_*
     *
     * @return string
     *
     * @phpstan-param Constraint::OP_* $otherOperator
     */
    public function compile($otherOperator);
    
    /**
     * @return Bound
     */
    public function getUpperBound();
    
    /**
     * @return Bound
     */
    public function getLowerBound();
    
    /**
     * @return string
     */
    public function getPrettyString();
    
    /**
     * @param string|null $prettyString
     *
     * @return void
     */
    public function setPrettyString($prettyString);
    
    /**
     * @return string
     */
    public function __toString();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ConstraintInterface::compile public function Provides a compiled version of the constraint for the given operator
The compiled version must be a PHP expression.
Executor of compile version must provide 2 variables:
4
ConstraintInterface::getLowerBound public function 4
ConstraintInterface::getPrettyString public function 4
ConstraintInterface::getUpperBound public function 4
ConstraintInterface::matches public function Checks whether the given constraint intersects in any way with this constraint 4
ConstraintInterface::setPrettyString public function 4
ConstraintInterface::__toString public function 4

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal