nowhere in the code I found "isset" or "=== null" comaprisons on getTargetDir(), so it seems to be ok. especially on scalar vars I personally prefer to use default values coming from the scalar value range. null only for objects, and it also doesn't mix return value types and the return annotation also says:
"* @return string The package targetDir"
not "* @return string|null The package targetDir"