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

PhanUndeclaredVariable not emitted when PhanParamTooMany emitted for method/new #3245

Closed
TysonAndre opened this issue Sep 9, 2019 · 0 comments · Fixed by #3246
Closed

PhanUndeclaredVariable not emitted when PhanParamTooMany emitted for method/new #3245

TysonAndre opened this issue Sep 9, 2019 · 0 comments · Fixed by #3246
Assignees
Labels
enhancement This improves the quality of Phan's analysis of a codebase

Comments

@TysonAndre
Copy link
Member

Noticed when checking for edge cases in arrow functions.

<?php
function accepts_one($x) {}
class Test {
    public static function no_args() {}
}
call_user_func(function () {
    accepts_one(1, $a);
    echo strlen('x', $other);
    // Should warn about missing $invalid
    $x = new class ($invalid) {};
    // Should warn about missing $a and $b (and PhanParamTooMany), but not $x
    $fn = fn() => [
        $z,
        new class ($a, $b) { public function __construct($first) {} public static function test(int $x) { return $x;}},
        Test::no_args(
            $c,  // should warn
            $d
        ),
    ];
    return $fn;
});
@TysonAndre TysonAndre added the enhancement This improves the quality of Phan's analysis of a codebase label Sep 9, 2019
@TysonAndre TysonAndre self-assigned this Sep 9, 2019
TysonAndre added a commit to TysonAndre/phan that referenced this issue Sep 9, 2019
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