When you do something like this
$array[] = 'value';
You are adding a value to an array. This assumes that the array already exists. PHP would go ahead and create the array. PHP7.2 is a little more strict, at least I think that is what was happening. So what you need to do is
$array = array();
$array[] = 'value';
Or in the example I gave above, create the array with the first value at the same time
$array = array('value');