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

Breadcrumb

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

function Constraint::toStringInContext

Returns a custom string representation of the constraint object when it appears in context of an $operator expression.

The purpose of this method is to provide meaningful descriptive string in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct strings in this context.

The method shall return empty string, when it does not handle customization by itself.

1 call to Constraint::toStringInContext()
Constraint::failureDescriptionInContext in vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php
Returns the description of the failure when this constraint appears in context of an $operator expression.

File

vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php, line 149

Class

Constraint
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Framework\Constraint

Code

protected function toStringInContext(Operator $operator, mixed $role) : string {
    return '';
}

API Navigation

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