feat: add return type and property type mismatch diagnostics#220
Draft
calebdw wants to merge 1 commit into
Draft
feat: add return type and property type mismatch diagnostics#220calebdw wants to merge 1 commit into
calebdw wants to merge 1 commit into
Conversation
9cf394a to
f48ba67
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
f48ba67 to
272f9d5
Compare
Contributor
|
This is surfacing a bunch of false positives that we need to resolve first, aka merging after 0.9.0 |
5eda8f3 to
7281dd8
Compare
Collaborator
Author
|
Can you post some examples of these false positives? |
7281dd8 to
26c49fa
Compare
Add two new diagnostic collectors to the type mismatch family: - type_mismatch_return: checks return statements against declared return types. Flags incompatible types, void functions returning values, and bare return; in non-void functions. Skips generators, abstract methods, mixed/untyped returns. - type_mismatch_property: checks $this->prop and self::$prop assignments against declared property types. Only plain = assignments; compound operators are skipped. Both reuse the existing is_type_compatible() policy layer and resolve_expression_type() infrastructure. A unified collect_type_mismatch_diagnostics() entry point groups all three collectors (argument, return, property). Closes #201
26c49fa to
e645de0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add two new diagnostic collectors to the type mismatch family:
type_mismatch_return: checks return statements against declared return types. Flags incompatible types, void functions returning values, and bare return; in non-void functions. Skips generators, abstract methods, mixed/untyped returns.
type_mismatch_property: checks $this->prop and self::$prop assignments against declared property types. Only plain = assignments; compound operators are skipped.
Both reuse the existing is_type_compatible() policy layer and resolve_expression_type() infrastructure. A unified collect_type_mismatch_diagnostics() entry point groups all three collectors (argument, return, property).
Closes #201