public function finalize(): self
    {
        if (!$this->isFinalized) {
            $this->normalizeDefinition();
            $this->isFinalized = true;
            $this->definition = new MockDefinition(
                $this->types,
                $this->customMethods,
                $this->customProperties,
                $this->customStaticMethods,
                $this->customStaticProperties,
                $this->customConstants,
                $this->className
            );
        }

        return $this;
    }