public function appliesToContext(ContextInterface $context) { if (!$context instanceof TypeContext && !$context instanceof PropertyContext) { return false; } $type = $context->getType(); if (!preg_match($this->regex, $type->getName())) { return false; } return $this->subRule->appliesToContext($context); }