Hi,
I was working on some unittests and phpunit always failed with error code 255. So I looked for what I was doing wrong and looked into the php error logs, where I found this:
PHP Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in kirby/config/helpers.php on line 38
Opening the file with my IDE (vscode) also throws that error on me. This is the function:
if (Helpers::hasOverride('attr') === false) { // @codeCoverageIgnore
/**
* Generates a list of HTML attributes
*
* @param array|null $attr A list of attributes as key/value array
* @param string|null $before An optional string that will be prepended if the result is not empty
* @param string|null $after An optional string that will be appended if the result is not empty
* @return string|null
*/
function attr(array|null $attr = null, string|null $before = null, string|null $after = null): string|null
{
return Html::attr($attr, null, $before, $after);
}
}
Did I just discover a bug or am I doing something strange in my tests suddenly causing this issue?
Kirby 3.8.2 (same problem with 3.8.0)
PHP 8.0.2 (MAMP)