Add Psalm to CI, begin using phpdoc generics syntax
Improves developer experience and maintainability by adding Psalm to the CI build. Also migrate to generics syntax in phpdoc annotations, as this is supported by Psalm and now the wider PHP ecosystem. The other issues detected by Psalm have been grandfathered in using a baseline file.