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 155085 - global variables and oop code completion problem
Summary: global variables and oop code completion problem
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-09 22:22 UTC by onthefloorr
Modified: 2011-07-25 13:35 UTC (History)
0 users

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 onthefloorr 2008-12-09 22:22:10 UTC
I was searching in bug tracker, but i didnt find similar one.
When i would liked to use global variables in methods, the code completion is not worked.
Example:

$variable = new test;
class some_class {
        public function some_method(test &$t)
        {
                 global $variable;
                 $variable->set_ref => here is the problem
        }
}

Version: Netbeans 6.5 stable
Comment 1 phatduckk 2008-12-20 23:44:32 UTC
I tried hinting the cc with a docblock but that didn't help

    /**
     *
     * @global User $user 
     */
    public function something() {
        global $user;
        $user->{no suggestions from cc} // was not able to hint the CC via docblocks
    }

it seems like being able to hint the cc via a @global docblock should do the trick... this works with @params extending it to work with @global would be 
cool. ... even tho globals are bad ;-) 
Comment 2 Tomasz Slota 2010-02-10 08:45:37 UTC
reassigning to default owner
Comment 3 Filip Zamboj 2010-09-15 12:27:50 UTC
batch reassigning
Comment 4 Petr Pisl 2011-04-08 11:30:15 UTC
Still reproducible in NB 7.0
Comment 5 mattg 2011-05-16 15:29:03 UTC
This is more of a pain than P4. It stops code completion working for large chunks of some systems e.g. working with Moodle, the global $DB access object, $OUTPUT object and $PAGE object has no code completion, which significantly slows down learning the changes that have occurred to the API.
Comment 6 Petr Pisl 2011-05-19 13:38:21 UTC
Fixed the case, when the global variable is defined in the same file as is use. So the onthefloorr's case is fixed. In other case you have to use the ways as phatduckk described, that now works as well. 

in web-main: http://hg.netbeans.org/web-main/rev/b525305c631a
in release701: http://hg.netbeans.org/releases/rev/5b58d4d989c3
Comment 7 Quality Engineering 2011-05-20 08:52:30 UTC
Integrated into 'main-golden', will be available in build *201105200400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b525305c631a
User: Petr Pisl <ppisl@netbeans.org>
Log: #155085 - global variables and oop code completion problem
Comment 8 Vladimir Riha 2011-07-25 13:35:17 UTC
Product Version: NetBeans IDE 7.0.1 (Build 201107211357)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Linux version 2.6.38-10-generic running on i386; UTF-8; en_US (nb)