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

Breadcrumb

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

function Rule2Literals::equals

Checks if this rule is equal to another one

Ignores whether either of the rules is disabled.

Parameters

Rule $rule The rule to check against:

Return value

bool Whether the rules are equal

Overrides Rule::equals

File

vendor/composer/composer/src/Composer/DependencyResolver/Rule2Literals.php, line 69

Class

Rule2Literals
@author Nils Adermann <naderman@naderman.de> @phpstan-import-type ReasonData from Rule

Namespace

Composer\DependencyResolver

Code

public function equals(Rule $rule) : bool {
    // specialized fast-case
    if ($rule instanceof self) {
        if ($this->literal1 !== $rule->literal1) {
            return false;
        }
        if ($this->literal2 !== $rule->literal2) {
            return false;
        }
        return true;
    }
    $literals = $rule->getLiterals();
    if (2 !== \count($literals)) {
        return false;
    }
    if ($this->literal1 !== $literals[0]) {
        return false;
    }
    if ($this->literal2 !== $literals[1]) {
        return false;
    }
    return true;
}

API Navigation

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