forked from apache/netbeans
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#2568 from junichi11/netbeans-5062
[NETBEANS-5062] PHPDoc static type incorrectly resolved when returned by another class
- Loading branch information
Showing
20 changed files
with
630 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
php/php.editor/test/unit/data/testfiles/completion/lib/nb5062/nb5062.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
class Test1 | ||
{ | ||
|
||
private function getTest2() { | ||
return Test2::returnStatic(); | ||
} | ||
|
||
private function getTest2ReturnType() { | ||
return Test2::returnStaticReturnType(); | ||
} | ||
|
||
private function getTest2PHPDoc() { | ||
return Test2::returnStaticPHPDoc(); | ||
} | ||
|
||
private function getTest2Self() { | ||
return Test2::returnSelf(); | ||
} | ||
|
||
private function getTest2SelfReturnType() { | ||
return Test2::returnSelfReturnType(); | ||
} | ||
|
||
private function getTest2SelfPHPDoc() { | ||
return Test2::returnSelfPHPDoc(); | ||
} | ||
|
||
public function testMethod() { | ||
echo "Test1" . PHP_EOL; | ||
} | ||
|
||
public function test() { | ||
$static1 = $this->getTest2(); | ||
$static1->testMethod(); | ||
|
||
$static2 = $this->getTest2ReturnType(); | ||
$static2->testMethod(); | ||
|
||
$static3 = $this->getTest2PHPDoc(); | ||
$static3->testMethod(); | ||
|
||
$self1 = $this->getTest2Self(); | ||
$self1->testMethod(); | ||
|
||
$self2 = $this->getTest2SelfReturnType(); | ||
$self2->testMethod(); | ||
|
||
$self3 = $this->getTest2SelfPHPDoc(); | ||
$self3->testMethod(); | ||
} | ||
|
||
} | ||
|
||
class Test2 | ||
{ | ||
|
||
public static function returnStatic() { | ||
return new static(); | ||
} | ||
|
||
public static function returnStaticReturnType(): static { | ||
} | ||
|
||
/** | ||
* @return static | ||
*/ | ||
public static function returnStaticPHPDoc() { | ||
} | ||
|
||
public static function returnSelf() { | ||
return new self(); | ||
} | ||
|
||
public static function returnSelfReturnType(): self { | ||
} | ||
|
||
/** | ||
* @return self | ||
*/ | ||
public static function returnSelfPHPDoc() { | ||
} | ||
|
||
public function testMethod() { | ||
echo "Test2" . PHP_EOL; | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...or/test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Self_01.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$self1->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
10 changes: 10 additions & 0 deletions
10
...or/test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Self_02.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$self2->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
10 changes: 10 additions & 0 deletions
10
...or/test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Self_03.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$self3->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
10 changes: 10 additions & 0 deletions
10
.../test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Static_01.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$static1->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
10 changes: 10 additions & 0 deletions
10
.../test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Static_02.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$static2->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
10 changes: 10 additions & 0 deletions
10
.../test/unit/data/testfiles/completion/lib/nb5062/nb5062.php.testNb5062Static_03.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Code completion result for source line: | ||
$static3->|testMethod(); | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD returnSelf() [STATIC] Test2 | ||
METHOD returnSelfPHPDoc() [STATIC] Test2 | ||
METHOD returnSelfReturnType() [STATIC] Test2 | ||
METHOD returnStatic() [STATIC] Test2 | ||
METHOD returnStaticPHPDoc() [STATIC] Test2 | ||
METHOD returnStaticReturnType() [STATIC] Test2 | ||
METHOD testMethod() [PUBLIC] Test2 |
107 changes: 107 additions & 0 deletions
107
php/php.editor/test/unit/data/testfiles/gotodeclaration/testNb5062/testNb5062.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
class Test1 | ||
{ | ||
|
||
private function getTest2() { | ||
return Test2::returnStatic(); | ||
} | ||
|
||
private function getTest2ReturnType() { | ||
return Test2::returnStaticReturnType(); | ||
} | ||
|
||
private function getTest2PHPDoc() { | ||
return Test2::returnStaticPHPDoc(); | ||
} | ||
|
||
private function getTest2Self() { | ||
return Test2::returnSelf(); | ||
} | ||
|
||
private function getTest2SelfReturnType() { | ||
return Test2::returnSelfReturnType(); | ||
} | ||
|
||
private function getTest2SelfPHPDoc() { | ||
return Test2::returnSelfPHPDoc(); | ||
} | ||
|
||
public function testMethod() { | ||
echo "Test1" . PHP_EOL; | ||
} | ||
|
||
public function test() { | ||
$static1 = $this->getTest2(); | ||
$static1->testMethod(); | ||
|
||
$static2 = $this->getTest2ReturnType(); | ||
$static2->testMethod(); | ||
|
||
$static3 = $this->getTest2PHPDoc(); | ||
$static3->testMethod(); | ||
|
||
$self1 = $this->getTest2Self(); | ||
$self1->testMethod(); | ||
|
||
$self2 = $this->getTest2SelfReturnType(); | ||
$self2->testMethod(); | ||
|
||
$self3 = $this->getTest2SelfPHPDoc(); | ||
$self3->testMethod(); | ||
} | ||
|
||
} | ||
|
||
class Test2 | ||
{ | ||
|
||
public static function returnStatic() { | ||
return new static(); | ||
} | ||
|
||
public static function returnStaticReturnType(): static { | ||
} | ||
|
||
/** | ||
* @return static | ||
*/ | ||
public static function returnStaticPHPDoc() { | ||
} | ||
|
||
public static function returnSelf() { | ||
return new self(); | ||
} | ||
|
||
public static function returnSelfReturnType(): self { | ||
} | ||
|
||
/** | ||
* @return self | ||
*/ | ||
public static function returnSelfPHPDoc() { | ||
} | ||
|
||
public function testMethod() { // Test2 | ||
echo "Test2" . PHP_EOL; | ||
} | ||
|
||
} |
Oops, something went wrong.