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.
PHP 8.3 Support: Dynamic class constant fetch (Part 4)
- apache#6701 - https://wiki.php.net/rfc/dynamic_class_constant_fetch - Fix the code completion feature - Add unit tests for the code completion and brace matching features
- Loading branch information
Showing
28 changed files
with
719 additions
and
11 deletions.
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
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
58 changes: 58 additions & 0 deletions
58
...estfiles/completion/lib/php83/testDynamicClassConstantFetch/dynamicClassConstantFetch.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,58 @@ | ||
<?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 Test { | ||
|
||
public const TEST = 'test'; | ||
public const TES = 'TES'; | ||
public const T = 'T'; | ||
public const TEST1 = self::{'TEST'}; | ||
public const TEST2 = self::{'TES' . 'T'}; | ||
public const TEST3 = self::{self::TES . self::T}; | ||
|
||
public static function method(): void { | ||
|
||
} | ||
} | ||
|
||
enum EnumTest: string { | ||
|
||
case TEST = 'test'; | ||
case TES = 'TES'; | ||
case T = 'T'; | ||
case TEST1 = self::{'TEST'}; | ||
case TEST2 = self::{'TES' . 'T'}; | ||
case TEST3 = self::{self::TES . self::T}; | ||
case TEST4 = EnumTest::{self::{self::TES} . self::T}; | ||
} | ||
|
||
function test(string $param = "test"): void { | ||
|
||
} | ||
|
||
$variable = 'TEST'; | ||
$e = 'e'; | ||
$test = "Test"; | ||
|
||
Test::{$variable}; | ||
$test::{$variable . $e}; | ||
|
||
Test::{Test::method()}::{test($variable)}; |
9 changes: 9 additions & 0 deletions
9
...ssConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_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,9 @@ | ||
Code completion result for source line: | ||
public const TEST3 = self::{self::T|ES . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CONSTANT T 'T' [PUBLIC] Test | ||
CONSTANT TES 'TES' [PUBLIC] Test | ||
CONSTANT TEST 'test' [PUBLIC] Test | ||
CONSTANT TEST1 ? [PUBLIC] Test | ||
CONSTANT TEST2 ? [PUBLIC] Test | ||
CONSTANT TEST3 ? [PUBLIC] Test |
21 changes: 21 additions & 0 deletions
21
...ssConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_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,21 @@ | ||
Code completion result for source line: | ||
Test::{$|variable}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
VARIABLE string $e [PUBLIC] dynamicClassConstantFetch.php | ||
VARIABLE string $test [PUBLIC] dynamicClassConstantFetch.php | ||
VARIABLE string $variable [PUBLIC] dynamicClassConstantFetch.php | ||
------------------------------------ | ||
VARIABLE $GLOBALS PHP Platform | ||
VARIABLE $HTTP_RAW_POST_DATA PHP Platform | ||
VARIABLE $_COOKIE PHP Platform | ||
VARIABLE $_ENV PHP Platform | ||
VARIABLE $_FILES PHP Platform | ||
VARIABLE $_GET PHP Platform | ||
VARIABLE $_POST PHP Platform | ||
VARIABLE $_REQUEST PHP Platform | ||
VARIABLE $_SERVER PHP Platform | ||
VARIABLE $_SESSION PHP Platform | ||
VARIABLE $argc PHP Platform | ||
VARIABLE $argv PHP Platform | ||
VARIABLE $http_response_header PHP Platform | ||
VARIABLE $php_errormsg PHP Platform |
4 changes: 4 additions & 0 deletions
4
...ssConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_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,4 @@ | ||
Code completion result for source line: | ||
Test::{$var|iable}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
VARIABLE string $variable [PUBLIC] dynamicClassConstantFetch.php |
21 changes: 21 additions & 0 deletions
21
...ssConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_04.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,21 @@ | ||
Code completion result for source line: | ||
$test::{$variable . $|e}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
VARIABLE string $e [PUBLIC] dynamicClassConstantFetch.php | ||
VARIABLE string $test [PUBLIC] dynamicClassConstantFetch.php | ||
VARIABLE string $variable [PUBLIC] dynamicClassConstantFetch.php | ||
------------------------------------ | ||
VARIABLE $GLOBALS PHP Platform | ||
VARIABLE $HTTP_RAW_POST_DATA PHP Platform | ||
VARIABLE $_COOKIE PHP Platform | ||
VARIABLE $_ENV PHP Platform | ||
VARIABLE $_FILES PHP Platform | ||
VARIABLE $_GET PHP Platform | ||
VARIABLE $_POST PHP Platform | ||
VARIABLE $_REQUEST PHP Platform | ||
VARIABLE $_SERVER PHP Platform | ||
VARIABLE $_SESSION PHP Platform | ||
VARIABLE $argc PHP Platform | ||
VARIABLE $argv PHP Platform | ||
VARIABLE $http_response_header PHP Platform | ||
VARIABLE $php_errormsg PHP Platform |
4 changes: 4 additions & 0 deletions
4
...ssConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_05.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,4 @@ | ||
Code completion result for source line: | ||
$test::{$variable . $e|}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
VARIABLE string $e [PUBLIC] dynamicClassConstantFetch.php |
6 changes: 6 additions & 0 deletions
6
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_06a.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,6 @@ | ||
Code completion result for source line: | ||
Test::{Tes|t::method()}::{test($variable)}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CLASS Test [PUBLIC] dynamicClassConstantFetch.php | ||
METHOD test() [PUBLIC] dynamicClassConstantFetch.php | ||
METHOD test(string $param = "test") [PUBLIC] dynamicClassConstantFetch.php |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_06b.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,4 @@ | ||
Code completion result for source line: | ||
Test::{Test::met|hod()}::{test($variable)}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
METHOD method() [STATIC] Test |
6 changes: 6 additions & 0 deletions
6
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_06c.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,6 @@ | ||
Code completion result for source line: | ||
Test::{Test::method()}::{te|st($variable)}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CLASS Test [PUBLIC] dynamicClassConstantFetch.php | ||
METHOD test() [PUBLIC] dynamicClassConstantFetch.php | ||
METHOD test(string $param = "test") [PUBLIC] dynamicClassConstantFetch.php |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_06d.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,4 @@ | ||
Code completion result for source line: | ||
Test::{Test::method()}::{test($var|iable)}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
VARIABLE string $variable [PUBLIC] dynamicClassConstantFetch.php |
11 changes: 11 additions & 0 deletions
11
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_07a.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,11 @@ | ||
Code completion result for source line: | ||
case TEST3 = self::|{self::TES . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CONSTANT T 'T' [PUBLIC] EnumTest | ||
CONSTANT TES 'TES' [PUBLIC] EnumTest | ||
CONSTANT TEST 'test' [PUBLIC] EnumTest | ||
CONSTANT TEST1 ? [PUBLIC] EnumTest | ||
CONSTANT TEST2 ? [PUBLIC] EnumTest | ||
CONSTANT TEST3 ? [PUBLIC] EnumTest | ||
CONSTANT TEST4 ? [PUBLIC] EnumTest | ||
CONSTANT class \EnumTest [PUBLIC] Magic Constant |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_07b.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,4 @@ | ||
Code completion result for source line: | ||
case TEST3 = self::{sel|f::TES . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
KEYWORD self:: null |
9 changes: 9 additions & 0 deletions
9
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_07c.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,9 @@ | ||
Code completion result for source line: | ||
case TEST3 = self::{self::TE|S . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CONSTANT TES 'TES' [PUBLIC] EnumTest | ||
CONSTANT TEST 'test' [PUBLIC] EnumTest | ||
CONSTANT TEST1 ? [PUBLIC] EnumTest | ||
CONSTANT TEST2 ? [PUBLIC] EnumTest | ||
CONSTANT TEST3 ? [PUBLIC] EnumTest | ||
CONSTANT TEST4 ? [PUBLIC] EnumTest |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_08a.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,4 @@ | ||
Code completion result for source line: | ||
case TEST4 = EnumTe|st::{self::{self::TES} . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CLASS EnumTest [PUBLIC] dynamicClassConstantFetch.php |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_08b.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,4 @@ | ||
Code completion result for source line: | ||
case TEST4 = EnumTest::{se|lf::{self::TES} . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
KEYWORD self:: null |
4 changes: 4 additions & 0 deletions
4
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_08c.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,4 @@ | ||
Code completion result for source line: | ||
case TEST4 = EnumTest::{self::{sel|f::TES} . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
KEYWORD self:: null |
9 changes: 9 additions & 0 deletions
9
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_08d.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,9 @@ | ||
Code completion result for source line: | ||
case TEST4 = EnumTest::{self::{self::TE|S} . self::T}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CONSTANT TES 'TES' [PUBLIC] EnumTest | ||
CONSTANT TEST 'test' [PUBLIC] EnumTest | ||
CONSTANT TEST1 ? [PUBLIC] EnumTest | ||
CONSTANT TEST2 ? [PUBLIC] EnumTest | ||
CONSTANT TEST3 ? [PUBLIC] EnumTest | ||
CONSTANT TEST4 ? [PUBLIC] EnumTest |
10 changes: 10 additions & 0 deletions
10
...sConstantFetch/dynamicClassConstantFetch.php.testDynamicClassConstantFetch_08e.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: | ||
case TEST4 = EnumTest::{self::{self::TES} . self::T|}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
CONSTANT T 'T' [PUBLIC] EnumTest | ||
CONSTANT TES 'TES' [PUBLIC] EnumTest | ||
CONSTANT TEST 'test' [PUBLIC] EnumTest | ||
CONSTANT TEST1 ? [PUBLIC] EnumTest | ||
CONSTANT TEST2 ? [PUBLIC] EnumTest | ||
CONSTANT TEST3 ? [PUBLIC] EnumTest | ||
CONSTANT TEST4 ? [PUBLIC] EnumTest |
25 changes: 25 additions & 0 deletions
25
.../lib/php83/testDynamicClassConstantFetchInConstDeclTyping/inConstantDeclarationTyping.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,25 @@ | ||
<?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 Test { | ||
public const TEST = "Test"; | ||
public const TEST1 = self::{}; | ||
} |
7 changes: 7 additions & 0 deletions
7
...onstantDeclarationTyping.php.testDynamicClassConstantFetchInConstDeclTyping_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,7 @@ | ||
Code completion result for source line: | ||
public const TEST1 = self::{|}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
KEYWORD parent:: null | ||
KEYWORD self:: null | ||
------------------------------------ | ||
KEYWORD array null |
25 changes: 25 additions & 0 deletions
25
...s/completion/lib/php83/testDynamicClassConstantFetchInEnumCaseTyping/inEnumCaseTyping.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,25 @@ | ||
<?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. | ||
*/ | ||
|
||
enum Test: string { | ||
case TEST = "Test"; | ||
case TEST1 = self::{}; | ||
} |
7 changes: 7 additions & 0 deletions
7
...seTyping/inEnumCaseTyping.php.testDynamicClassConstantFetchInEnumCaseTyping_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,7 @@ | ||
Code completion result for source line: | ||
case TEST1 = self::{|}; | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
KEYWORD parent:: null | ||
KEYWORD self:: null | ||
------------------------------------ | ||
KEYWORD array null |
Oops, something went wrong.