factory = $factory; $this->nonCachableClasses = $nonCachableClasses; } /** * {@inheritDoc} */ public function getInstance(Constraint $constraint) { $className = $constraint->validatedBy(); if (in_array($className, $this->nonCachableClasses, true)) { return new $className(); } return $this->factory->getInstance($constraint); } }