function SandboxValidationEvent::addResult

Adds a validation result to the event.

Parameters

\Drupal\package_manager\ValidationResult $result: The validation result to add.

Throws

\InvalidArgumentException Thrown if the validation result is not an error.

2 calls to SandboxValidationEvent::addResult()
SandboxValidationEvent::addError in core/modules/package_manager/src/Event/SandboxValidationEvent.php
Convenience method to flag a validation error.
SandboxValidationEvent::addErrorFromThrowable in core/modules/package_manager/src/Event/SandboxValidationEvent.php
Convenience method, adds an error validation result from a throwable.
1 method overrides SandboxValidationEvent::addResult()
StatusCheckEvent::addResult in core/modules/package_manager/src/Event/StatusCheckEvent.php
Adds a validation result to the event.

File

core/modules/package_manager/src/Event/SandboxValidationEvent.php, line 76

Class

SandboxValidationEvent
Base class for events dispatched before a stage life cycle operation.

Namespace

Drupal\package_manager\Event

Code

public function addResult(ValidationResult $result) : void {
    // Only errors are allowed for this event.
    if ($result->severity !== SystemManager::REQUIREMENT_ERROR) {
        throw new \InvalidArgumentException('Only errors are allowed.');
    }
    $this->results[] = $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.