You are here

protected function MergeablePluginDefinitionTrait::validateMergeDefinition in Plugin 8.2

Validates whether another definition is compatible with this one.

Throws

\InvalidArgumentException

2 calls to MergeablePluginDefinitionTrait::validateMergeDefinition()
MergeablePluginDefinitionTrait::mergeDefaultDefinition in src/PluginDefinition/MergeablePluginDefinitionTrait.php
Implements \Drupal\plugin\PluginDefinition\PluginDefinitionInterface::mergeDefaultDefinition().
MergeablePluginDefinitionTrait::mergeOverrideDefinition in src/PluginDefinition/MergeablePluginDefinitionTrait.php
Implements \Drupal\plugin\PluginDefinition\PluginDefinitionInterface::mergeOverrideDefinition().

File

src/PluginDefinition/MergeablePluginDefinitionTrait.php, line 59

Class

MergeablePluginDefinitionTrait
Implements the plugin merger parts of \Drupal\plugin\PluginDefinition\PluginDefinitionInterface.

Namespace

Drupal\plugin\PluginDefinition

Code

protected function validateMergeDefinition(PluginDefinitionInterface $other_definition) {
  if (!$this
    ->isDefinitionCompatible($other_definition)) {
    throw new \InvalidArgumentException(sprintf('$other_definition must be an instance of %s, but %s was given.', get_class($this), get_class($other_definition)));
  }
}