为什么不能在类中的数组值中使用运算符?

Try this:

$test = array (2+2);
var_dump($test);

Then try the same but inside a class:

class test {
    public $test = array(2+2);
}

I just want to know why one gets a parser error and maybe how to solve this (in a class) as code-friendly and performant as possible.

You cannot use statements to initialize class fields. It must be a literal, a constant value. A workaround is to use a constructor:

class Test {
    public $test;

    public function __construct() {
        $this->test = array(2+2);
    }
}

From the manual:

Class member variables are called "properties". You may also see them referred to using other terms such as "attributes" or "fields", but for the purposes of this reference we will use "properties". They are defined by using one of the keywords public, protected, or private, followed by a normal variable declaration. This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.

The reason is because assignments to properties in a class must be static declarations. They cannot be expressions that are evaluated.

That is you can do:

public $test = array(4); // static assignment
public $test = 'some string'; // static assignment
public $test = strtoupper('  some string  '); // invalid, expression
public $test = $global_variable; // invalid, not a constant expression
public $test = time(); // invalid, an expression