src/Reflection/ReflectionFunctionAbstract.php
public function setBodyFromString(string $newBody) : void
    {
        $this->node->stmts = $this->loadStaticParser()->parse('<?php ' . $newBody);
    }
public function setBodyFromString(string $newBody) : void
    {
        $this->node->stmts = $this->loadStaticParser()->parse('<?php ' . $newBody);
    }
Override the method or function's body of statements with an entirely new
body of statements within the reflection.

@example
$reflectionFunction->setBodyFromString('return true;');