What is null coalescing assignment ??= operator in PHP 7.4

From the docs: Coalesce equal or ??=operator is an assignment operator. If the left parameter is null, assigns the value of the right paramater to the left one. If the value is not null, nothing is done. Example: // The folloving lines are doing the same $this->request->data[‘comments’][‘user_id’] = $this->request->data[‘comments’][‘user_id’] ?? ‘value’; // Instead of repeating … Read more

Trying to access array offset on value of type null

Sounds like your variable isn’t set. Check with the following isset calls: isset($this->config); isset($this->config[‘backend’]); isset($this->config[‘backend’][‘api_prefix’]); You can actually check multiple vars in one isset call (isset($x, $y, $z)), but this will let you see which var specifically is missing

Why I am suddenly getting a “Typed property must not be accessed before initialization” error when introducing properties type hints?

Since PHP 7.4 introduces type-hinting for properties, it is particularly important to provide valid values for all properties, so that all properties have values that match their declared types. A property that has never been assigned doesn’t have a null value, but it is on an undefined state, which will never match any declared type. … Read more