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 191666 - `t` variable does not provide autocompletion when method call is from $this object
Summary: `t` variable does not provide autocompletion when method call is from $this o...
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 10:42 UTC by k4emic
Modified: 2011-08-26 14:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Case of failure in phpdoc autocomplete (30.06 KB, image/png)
2011-04-04 13:53 UTC, k4emic
Details
Intended behaviour for autocomplete (33.13 KB, image/png)
2011-04-04 13:54 UTC, k4emic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description k4emic 2010-11-05 10:42:10 UTC
When assigning a variable to the return of a function, the netbeans IDE provides autocompletion. There is one exception though.


In some class: 

class SomeClass {

	function foo() {
		$s = $t = $u = $v = $w = $x = $y = $z = $this->$bar();
	}

	function foo2() {
		$f = $this->$bar();
		$t = $this->$bar();
		$T = $this->$bar();
	}
	
	/**
	 * @return SomeClassReturn
	 */
	function bar() {
		
	}

}

the `$t` (lowercase) variables in the ::foo() and ::foo2() methods will not provide autocompletion even though the other variables do.

If I assign the $t variable directly to the desired object, it will provide autocompletion.

This bug also applies to Netbeans 7.0M1
Comment 1 OndrejBrejla 2011-04-04 11:32:15 UTC
I'm sorry, but I think that I don't understand what you mean. Where is a return statement which doesn't work? Can you discribe that step by step until the problem occurs? With a highlighted caret position where should autocompletion appear? And can you try to reproduce it in NB 7.0 RC1? Thanks.
Comment 2 k4emic 2011-04-04 13:53:38 UTC
Created attachment 107471 [details]
Case of failure in phpdoc autocomplete

IDE does not supply autocomplete for variable $t
Comment 3 k4emic 2011-04-04 13:54:46 UTC
Created attachment 107472 [details]
Intended behaviour for autocomplete

IDE offers autocompletion on $a (and other) variables
Comment 4 k4emic 2011-04-04 14:06:20 UTC
I've attached two images, which I hope will make the issue more clear. The screenshots are from 7.0M2, but the issue also appears in the RC1.

$a->[ctrl+space] offers autocompletion according to phpdoc comments
$t->[ctrl+space] does not offer autocompletion according to phpdoc comments

Sample code: (opening and closing tags omitted)

class Bar {

	/**
	 * PHPdoc for getBar()
	 */
	function bar() {
		
	}

	/**
	 * Returns Foo object
	 * @return Foo
	 */
	function getFoo() {
		
	}

}

class Foo {

	function foo() {
		$a = $this->getBar();
		$b = $this->getBar();
		$t = $this->getBar();
		$t2 = $this->getBar();

		$a->// gives autocompletion
		$t->// does not give autocompletion
	}

	/**
	 * @return Bar
	 */
	function getBar() {
		
	}

}
Comment 5 Tomas Mysik 2011-06-03 10:20:50 UTC
Batch reassigning.
Comment 6 Tomas Mysik 2011-06-08 09:31:13 UTC
Editor area.
Comment 7 Ondrej Brejla 2011-08-25 15:08:22 UTC
Fixed in web-main: http://hg.netbeans.org/web-main/rev/eb8e5a7b4652
Comment 8 Quality Engineering 2011-08-26 14:38:34 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/eb8e5a7b4652
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #191666 - `t` variable does not provide autocompletion when method call is from $this object