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

Bad detection of undeclared variable #287

Open
Blount opened this issue Dec 7, 2024 · 0 comments
Open

Bad detection of undeclared variable #287

Blount opened this issue Dec 7, 2024 · 0 comments
Labels

Comments

@Blount
Copy link

Blount commented Dec 7, 2024

Describe the bug
Variable is not marked as undefined in method if phpdoc describe the variable in other method.

Describe the eclipse environment
Version: 2024-12
PDT : 8.2

To Reproduce

Steps to reproduce the behavior:

<?php

class Test
{
    public function test1()
    {
        /**
         * @var \DateTime $date
         */
        $date = new \DateTime();
    }

    public function test2()
    {
        $test = $date->test();

        echo $test;
    }
}

Expected behavior
$date in test2 should marked as undefined.
If I remove "@var \DateTime $date" comment, $date in test2 is correctly marked as undefined.

Screenshots
image

@Blount Blount added the bug label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant