Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHPStan failure when getting object value from JsonParseNode #18

Merged
merged 1 commit into from
Mar 21, 2023

Conversation

Ndiritu
Copy link
Contributor

@Ndiritu Ndiritu commented Mar 21, 2023

Using the generic PHPDoc tags added in microsoft/kiota-abstractions-php#42 the expected return type after calling the Parsable factory method is an object that implements Parsable

PHPStan currently fails with:

------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   JsonParseNode.php                                                                                                                                                                                                         
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  :116   Method Microsoft\Kiota\Serialization\Json\JsonParseNode::getObjectValue() should return (T of Microsoft\Kiota\Abstractions\Serialization\Parsable)|null but returns Microsoft\Kiota\Abstractions\Serialization\Parsable.  
         💡 Type Microsoft\Kiota\Abstractions\Serialization\Parsable is not always the same as T. It breaks the contract for some argument types, typically subtypes.                                                               
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@SilasKenneth SilasKenneth merged commit c7d670f into dev Mar 21, 2023
@SilasKenneth SilasKenneth deleted the fix/philip/static-analysis branch March 21, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants