foreach($docx->getTemplateVariables()['document'] as $unused)
$docx->cleanTemplateVariable($unused, 'block');
One would expect the unused variable $SOME_VAR$ to be removed from the document like in the example, however the output becomes $$. Note, this works as expected with inline, just not with block. If the block cannot be identified correctly, then the expected result would be for the function to act like inline and remove the $$ also.