PSR, allow $doc to be null on DOMDoc ele