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

Phan fails to warn about @param object $x when the real type is more specific #3749

Closed
TysonAndre opened this issue Feb 27, 2020 · 0 comments · Fixed by #3750
Closed

Phan fails to warn about @param object $x when the real type is more specific #3749

TysonAndre opened this issue Feb 27, 2020 · 0 comments · Fixed by #3750
Labels
enhancement This improves the quality of Phan's analysis of a codebase

Comments

@TysonAndre
Copy link
Member

TysonAndre commented Feb 27, 2020

Observed: Phan emits no warnings for the following snippet
Expected: Phan (1) warns about the phpdoc comment being more permissive than the real type, and (2) warns about the missing method.

(should ignore nullability and non-object types in the union type for the comparison)

<?php
/**
 * @param object $dom
 */
function vaguer_comment(DOMDocument $dom) {
    $dom->missingMethod('test');
}
/**
 * For php 8.0, this should also warn
 * @param object $dom
 */
function somewhat_vaguer_comment(DOMDocument|false $dom) {
    $dom->missingMethod('test');
}
@TysonAndre TysonAndre added the enhancement This improves the quality of Phan's analysis of a codebase label Feb 27, 2020
TysonAndre added a commit to TysonAndre/phan that referenced this issue Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This improves the quality of Phan's analysis of a codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant