fix: phpstan warnings (rebased)

Closes #3561548

This is a rebased version of !2 to make it easier to work on as that MR has the same branch name as 2.x which we need to rebase.

Edited by Andy Broomfield

Merge request reports

Loading