public function enableValidation(array $validationGroups = []): self
    {
        $defaultValidationFailedEvent = $this->defaultValidationFailedEvent;
        $defaultThrowableEvent        = $this->defaultThrowableEvent;

        /**
         * @psalm-var class-string|null $defaultValidationFailedEvent
         * @psalm-var class-string|null $defaultThrowableEvent
         */

        return new self(
            $this->isEventListener,
            $this->isCommandHandler,
            true,
            $validationGroups,
            $defaultValidationFailedEvent,
            $defaultThrowableEvent
        );
    }
public function enableValidation(array $validationGroups = []): self
    {
        $defaultValidationFailedEvent = $this->defaultValidationFailedEvent;
        $defaultThrowableEvent        = $this->defaultThrowableEvent;

        /**
         * @psalm-var class-string|null $defaultValidationFailedEvent
         * @psalm-var class-string|null $defaultThrowableEvent
         */

        return new self(
            $this->isEventListener,
            $this->isCommandHandler,
            true,
            $validationGroups,
            $defaultValidationFailedEvent,
            $defaultThrowableEvent
        );
    }
public function enableValidation ( array $ validationGroups = [ ] ) : self { $ defaultValidationFailedEvent = $ this -> defaultValidationFailedEvent ; $ defaultThrowableEvent = $ this -> defaultThrowableEvent ; /**
         * @psalm-var class-string|null $defaultValidationFailedEvent
         * @psalm-var class-string|null $defaultThrowableEvent
         */ return new self ( $ this -> isEventListener , $ this -> isCommandHandler , true , $ validationGroups , $ defaultValidationFailedEvent , $ defaultThrowableEvent ) ; }
Enable validation.

@psalm-param array<array-key, string> $validationGroups

@param string[] $validationGroups

@return self
Enable validation .