This seems to be a bug in PHP 7.1.12 and not in Nextcloud:
https://bugs.php.net/bug.php?id=75570
https://bugs.php.net/bug.php?id=75608
Looking at the changelogs for PHP itself, this shoud be fixed in 7.1.13 which comes out in January:
"- Opcache:
. Fixed bug #75608 (“Narrowing occurred during type inference” error).
(Laruence, Dmitry)
. Fixed bug #75570 (“Narrowing occurred during type inference” error).
(Dmitry)"
Source: https://raw.githubusercontent.com/php/php-src/PHP-7.1/NEWS
The fix seems to be from this commit:
So I guess the only solution at the moment is to manually compile PHP with that fix or use the RC1 of 7.1.13.
One thing that would be nice is if the Nextcloud logs could be pruned by the type of error, so that this mess caused to my log files by PHP 7.1.12 could be flushed down the drain.