开发者

Netbeans PHP, how to make autocomplete work from an included file (the classes are declared in the parent)

开发者 https://www.devze.com 2023-04-03 19:44 出处:网络
here is the file structure for my question: test1.php <?php c开发者_Go百科lass Test1 { public function testMethod () {

here is the file structure for my question:

test1.php

<?php
c开发者_Go百科lass Test1 {
    public function testMethod () {
        echo 'test1';
    }
}

test2.php

<?php
include('test1.php');
$test1 = new Test1();
include('test3.php');

test3.php

<?php
$test1-> //this is where I'd like the autocomplete to work.

So, my question is how to make the autocomplete work in the test3.php file for classes declared in parents files.

I know about the PHPDoc comment trick:

test3.php

<?php
/* @var $test1 Test1 */
$test1-> //Now the autocomplete works.

In this case it could work, but in a case where there is a lot of classes and a lot of files like test3.php, It's not viable to have 15 comment lines at the begining of 30 files and what would happens if I add a class later.

If it's impossible, is there a way to enable autocomplete for everything (even undeclared)?

Or would there be a better way to structure my code to make it work with the autocomplete?

Thanks.


I met the same question. Seems netbeans doesn't handle the autocomplete in recursive way.I Hope Sun will change it in next release. Eclipse Helios can meet the demand and it's also free, if you don't mind changing your IDE. For now I'm using phpDesigner, most of it's functions are only so so, but the autocomplete is extraordinarily greate.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号