Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Validator not catching a variable via PHPDoc comment(Validator warns about undefind variable even when an array is defined via PHPDoc comment)
Validator not catching a variable via PHPDoc comment [message #1803016] Wed, 20 February 2019 22:47
Perttu Myry is currently offline Perttu MyryFriend
Messages: 1
Registered: February 2019
Junior Member
We have a lot undefined variable warnings in our project. We use Phalcon and its MVC model and it's quite common in our case that a controller gives an array to a view. Then in the view all the variables given by controller are documented as PHPDoc comments.

For sake of clarity, I simplified this test to a bare minimum setup.

/** @var array $arr */
echo $arr['test'];

The third line keeps on warning about an unused variable.

What would be a suggested way around this issue? Should the PHPDoc comment somehow also contain information about the array keys? Or is this just a bug in the PDT validator implementation?

What is interesting is that after changing that minimum test case into this the validator no longer warns about an undefined variable.

/** @var array $arr */
echo $arr['test'];
Previous Topic:PHP Conditionals Formatter
Next Topic:How to use Eclipse for both Java and PHP?
Goto Forum:

Current Time: Mon Jun 05 21:40:29 GMT 2023

Powered by FUDForum. Page generated in 0.01864 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top