This error indicates a php version incompatibility. It can come from one of third party apps.
#[\ReturnTypeWillChange] is a new attribute introduced in PHP 8.1, which signals that a mismatching tentative return type should not emit a deprecation notice.
PHP versions prior to 8.0 parses the attribute syntax as a code comment, and does not cause any syntax errors. Adding #[\ReturnTypeWillChange] attribute to a class method does not cause any issues, but omits the deprecation notice in PHP 8.1.
If the overwrite of the files will not fix the error, can you try to disable all third party stuff that you might have instaleld and give the upgrader another go?