This adds more precise types for some parts of the package. This PR specifically targets only places that are not generated by the GenerateEndpoints script (this will be covered by a separate PR solving #217).
I found those by running phpstan at level 6 (instead of the existing config using level 5). This PR does not solve all non-endpoints errors of level 6:
I excluded most of the errors reported in tests (more precise types in tests don't bring benefits to consumers of the package, especially when the missing types are the void return types on test methods themselves)
I haven't added the more precise type for SerializerInterface::deserialize as I'm not sure about the correct type:
$body has a native type ?string but the phpdoc type says string and implementations don't seem to account for null (so maybe string is the expected type
I'm not sure about the expected type for $headers as callers are passing $response['transfer_stats'] there (while ringphp documents that response headers are in $response['headers'])
I haven't solve all errors in Connection because dealing with RingPhp responses is complex.
Those can be solved later (before enabling level 6)
Issues Resolved
n/a
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Description
This adds more precise types for some parts of the package. This PR specifically targets only places that are not generated by the
GenerateEndpoints
script (this will be covered by a separate PR solving #217). I found those by running phpstan at level 6 (instead of the existing config using level 5). This PR does not solve all non-endpoints errors of level 6:void
return types on test methods themselves)SerializerInterface::deserialize
as I'm not sure about the correct type:$body
has a native type?string
but the phpdoc type saysstring
and implementations don't seem to account fornull
(so maybestring
is the expected type$headers
as callers are passing$response['transfer_stats']
there (while ringphp documents that response headers are in$response['headers']
)Connection
because dealing with RingPhp responses is complex.Those can be solved later (before enabling level 6)
Issues Resolved
n/a
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.