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.4 Support: new MyClass()->method() without parentheses (Part 6)
- apache#8035 - https://wiki.php.net/rfc#php_84 - https://wiki.php.net/rfc/new_without_parentheses - Add a unit test for the navigator
- Loading branch information
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../netbeans/modules/php/editor/csl/NavigatorTest/structure/php84/newWithoutParentheses.pass
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,22 @@ | ||
|-#anon#newWithoutParentheses_php#1 [846, 888] : ESCAPED{{}} | ||
|--CONSTANT [864, 872] : ESCAPED{CONSTANT}ESCAPED{ }<font color="#999999">ESCAPED{'constant'}</font> | ||
|-#anon#newWithoutParentheses_php#2 [910, 952] : ESCAPED{{}} | ||
|--CONSTANT [928, 936] : ESCAPED{CONSTANT}ESCAPED{ }<font color="#999999">ESCAPED{'constant'}</font> | ||
|-#anon#newWithoutParentheses_php#3 [978, 1016] : ESCAPED{{}} | ||
|--$field [998, 1003] : ESCAPED{$field} | ||
|-#anon#newWithoutParentheses_php#4 [1035, 1093] : ESCAPED{{}} | ||
|--$staticField [1062, 1073] : ESCAPED{$staticField} | ||
|-#anon#newWithoutParentheses_php#5 [1114, 1155] : ESCAPED{{}} | ||
|--method [1142, 1153] : ESCAPED{method}ESCAPED{(}ESCAPED{)} | ||
|-#anon#newWithoutParentheses_php#6 [1190, 1231] : ESCAPED{{}} | ||
|--method [1218, 1229] : ESCAPED{method}ESCAPED{(}ESCAPED{)} | ||
|-#anon#newWithoutParentheses_php#7 [1248, 1302] : ESCAPED{{}} | ||
|--staticMethod [1283, 1300] : ESCAPED{staticMethod}ESCAPED{(}ESCAPED{)} | ||
|-#anon#newWithoutParentheses_php#8 [1325, 1368] : ESCAPED{{}} | ||
|--__invoke [1353, 1366] : ESCAPED{__invoke}ESCAPED{(}ESCAPED{)} | ||
|-#anon#newWithoutParentheses_php#9 [1399, 1442] : ESCAPED{{}} | ||
|--__invoke [1427, 1440] : ESCAPED{__invoke}ESCAPED{(}ESCAPED{)} | ||
|-#anon#newWithoutParentheses_php#10 [1451, 1486] : ESCAPED{{}} | ||
|-#anon#newWithoutParentheses_php#11 [1508, 1571] : ESCAPED{{}} | ||
|--$field [1559, 1564] : ESCAPED{$field}<font color="#999999">:ESCAPED{int}</font> | ||
|-#anon#newWithoutParentheses_php#12 [1591, 1639] : ESCAPED{{}} |
67 changes: 67 additions & 0 deletions
67
php/php.editor/test/unit/data/testfiles/structure/php84/newWithoutParentheses.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,67 @@ | ||
<?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. | ||
*/ | ||
|
||
// anonymous classes | ||
|
||
echo new class { | ||
const CONSTANT = 'constant'; | ||
}::CONSTANT; | ||
|
||
echo new class { | ||
const CONSTANT = 'constant'; | ||
}::{'CONSTANT'}; | ||
|
||
echo new class { | ||
public $field = 'field'; | ||
}->field; | ||
|
||
echo new class { | ||
public static $staticField = 'static field'; | ||
}::$staticField; | ||
|
||
new class { | ||
public function method() {} | ||
}->method(); | ||
|
||
$anon = new #[Attr()] class { | ||
public function method() {} | ||
}->method(); | ||
|
||
new class { | ||
public static function staticMethod() {} | ||
}::staticMethod(); | ||
|
||
new class { | ||
public function __invoke() {} | ||
}(); | ||
|
||
$anon = new #[Attr(1, 2)] class { | ||
public function __invoke() {} | ||
}(); | ||
|
||
new class () implements ArrayAccess { | ||
}['key']; | ||
|
||
$anon = new class () implements ArrayAccess { | ||
private int $field = 1; | ||
}['key']; | ||
|
||
isset(new class ($a, 1, "test") implements ArrayAccess { | ||
}['key']); |
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