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

Breadcrumb

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

function Callback::__construct

Same name in this branch
  1. 11.1.x vendor/phpunit/phpunit/src/Framework/Constraint/Callback.php \PHPUnit\Framework\Constraint\Callback::__construct()
  2. 11.1.x core/modules/migrate/src/Plugin/migrate/process/Callback.php \Drupal\migrate\Plugin\migrate\process\Callback::__construct()

Parameters

string|string[]|callable|array<string,mixed>|null $callback The callback definition:

string[]|null $groups:

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/Callback.php, line 33

Class

Callback
Defines custom validation rules through arbitrary callback methods.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(array|string|callable|null $callback = null, ?array $groups = null, mixed $payload = null, array $options = []) {
    // Invocation through attributes with an array parameter only
    if (\is_array($callback) && 1 === \count($callback) && isset($callback['value'])) {
        $callback = $callback['value'];
    }
    if (!\is_array($callback) || !isset($callback['callback']) && !isset($callback['groups']) && !isset($callback['payload'])) {
        $options['callback'] = $callback;
    }
    else {
        $options = array_merge($callback, $options);
    }
    parent::__construct($options, $groups, $payload);
}
RSS feed
Powered by Drupal