ParseError: syntax error, unexpected ‘|’ module content_export_csv

Error:
“ParseError: syntax error, unexpected ‘|’ , expecting ‘;’ or ‘{‘ in Composer\Autoload\{closure}() (line 76 of modules/contrib/content_export_csv/src/ContentExport.php).”

The issue is related to the PHP version and the module in question.
In this case: content_export_csv. The Union Types “: int|array” caused the issue and it is not supported by your PHP version.

Here the line 76 referenced that is giving the error:
"public function getNodeIds(string $nodeType, int $status = 1) : int|array {"


In my case, I simply removed it and I was able to use the module on PHP7.4.
The function now becomes:
public function getNodeIds(string $nodeType, int $status = 1) {