Add generics PHPDoc tags to ParseNode methods #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PHP doesn't support generics. The return type of our
ParseNode
object methods is aParsable
andEnum
for enum-related methods yet model setters expect a concrete type. This causes static analysis failures like:This change tells PHPStan that a generic type will be passed and returned.
Impact of this change can be viewed at https://github.com/microsoft/kiota-samples/actions/runs/4383543674/jobs/7673923173 where PHPStan is run using abstractions changes from this branch. The only existing issue is around arrays of primitive types. Arrays of Parsable implementations/Arrays of Enums are handled.
Still need to figure out a fix for the PHPDoc for
getCollectionOfPrimitiveValues
. The generic PHPDoc format doesn't match primitive types.part of microsoft/kiota#2378