src/Reflection/ReflectionClass.php
public function setFinal(bool $isFinal) : void
    {
        if (! $this->node instanceof ClassNode) {
            throw NotAClassReflection::fromReflectionClass($this);
        }

        if ($isFinal === true) {
            $this->node->flags |= ClassNode::MODIFIER_FINAL;

            return;
        }

        $this->node->flags &= ~ClassNode::MODIFIER_FINAL;
    }
public function setFinal(bool $isFinal) : void
    {
        if (! $this->node instanceof ClassNode) {
            throw NotAClassReflection::fromReflectionClass($this);
        }

        if ($isFinal === true) {
            $this->node->flags |= ClassNode::MODIFIER_FINAL;

            return;
        }

        $this->node->flags &= ~ClassNode::MODIFIER_FINAL;
    }
Set whether this class is final or not

@throws NotAClassReflection