This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226308 - PHP Doc @var type does not work correctly with static variables
Summary: PHP Doc @var type does not work correctly with static variables
Status: RESOLVED INVALID
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-19 09:27 UTC by msk
Modified: 2013-02-26 09:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description msk 2013-02-19 09:27:51 UTC
Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851)
Operating System = Linux version 3.2.0-38-generic running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

If I add PHP Doc to class field Code Complete does not show methods and fields of specified class. (See example)
But instead it shows these suggestions for local variable of any method if it has the same name

Also I can't use "vdoc + Tab" shortcut to paste code Template before field definition

/* @var $odb SomeClass */
    private static $odb;

public function test() {
   self::$odb->... // here should be suggestion with public methods and fields of SomeClass
    
   $odb->... // unexpectedly we have SomeClass methods shown for this variable
}
Comment 1 Vladimir Riha 2013-02-19 12:18:51 UTC
Possibly duplicate of issue 226071?
Comment 2 Ondrej Brejla 2013-02-26 09:59:11 UTC
VDoc can't be used before class field. You have to use common PHPDoc format 

/** @var SomeClass */

You see...2 asterisks and without field name.

> $odb->... // unexpectedly we have SomeClass methods shown for this variable

That's because VDoc creates a virtual declaration of $odb variable. So as I wrote, don't use VDoc where common PHPDoc must be used. VDoc is just for use in a "code"...I think inside method bodies, cycles and such.

If you use this, everything works properely in 7.3:

<?php

class SomeClass {
function someFoo() {}
}

class Test {
/** @var SomeClass */
private static $odb;

function testStatic() {
self::$odb-> //CC works here
$odb-> //CC doesn't work here
}
}

?>

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.6.0_34; Java HotSpot(TM) Client VM 20.9-b04
Runtime: Java(TM) SE Runtime Environment 1.6.0_34-b04
System: Linux version 3.5.0-23-generic running on i386; UTF-8; cs_CZ (nb)