/** * Apply all of the callbacks for this filter. * * @param mixed $data * @param int $offset * @return mixed * @throws \TypeError */ public function applyCallbacks($data = null, int $offset = 0) { if ($offset === 0) { if (!empty($this->pattern)) { if (!\preg_match($this->pattern, $data)) { throw new \TypeError(\sprintf('Pattern match failed (%s).', $this->index)); } } return parent::applyCallbacks($data, 0); } return parent::applyCallbacks($data, $offset); }