How-to articles, tricks, and solutions about PHP-7.4

"Typed property must not be accessed before initialization" error when introducing properties type hints?

In PHP, the "Typed property must not be accessed before initialization" error is encountered when a property is defined with a type hint, but it is accessed before it has been explicitly assigned a value.

Array and string offset access syntax with curly braces is deprecated

In PHP, using array and string offset access syntax with curly braces has been deprecated as of PHP 7.4.

Message: Trying to access array offset on value of type null

This error message is indicating that you are trying to access an array offset (i.e., an element of an array) but the value being accessed is null.

Update PHP to 7.4 macOS Catalina with brew

To update PHP to version 7.4 on macOS Catalina using Homebrew, you can use the following steps: