Errors parsing Standard input code: Bitwise OR ‘|’

I hope someone can assist me with identifying why WordPress rejects the “|” (pipes) used as bitwise OR statements for the variable types.

if (!function_exists('mb_convert_encoding')) {
    function mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false { return pMbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
}

I am running in PHP 7.3 and have pulled in the Twig/Symfony composer libraries (v3.1.1) which requires PHP >=7.2.5.

Every time I try and commit the Twig/Symfony libraries to my plugin’s SVN repository, it results in the following:

svn: E165001: Commit failed (details follow):
svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:
***********************************
PHP error in: starfish-reviews/tags/2.3.28/composer/vendor/symfony/polyfill-mbstring/bootstrap80.php:
Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in Standard input code on line 15
Errors parsing Standard input code
***********************************



Source link