public function validateMatches(string $key, array $def, $value)
    {
        if (isset($def['matches'])) {
            if ($def['matches'][0] == '!') {
                $fieldName = substr($def['matches'], 1);
                if ($value == $this->getForm()->$fieldName) {
                    $this->addError($key, 'form.value_must_not_be_the_same', array('%other_field%' => $this->getFieldCaption($fieldName)));
                }
            } else {
                if ($value != $this->getForm()->{$def['matches']}) {
                    $this->addError($key, 'form.value_must_be_the_same', array('%other_field%' => $this->getFieldCaption($def['matches'])));
                }
            }
        }
    }