public function isValid($context = null)
    {
        // When there's an invalid data type, it should immediately report as invalid.
        if ($this->invalidDataTypeException !== null) {
            return false;
        }

        // When there's no data and the filter itself is not required,
        // it should immediately report as valid.
        if (!$this->data && !$this->isRequired()) {
            return true;
        }

        // Don't filter at all when "inputsToFilter" is set to empty array
        if (!$this->needsFiltering()) {
            return true;
        }

        return parent::isValid($context);
    }