[ https://issues.apache.org/jira/browse/NETBEANS-6193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Junichi Yamamoto closed NETBEANS-6193. -------------------------------------- Fix Version/s: NB13 Resolution: Fixed Fixed. > Can't use attributes with interface constants and methods > --------------------------------------------------------- > > Key: NETBEANS-6193 > URL: https://issues.apache.org/jira/browse/NETBEANS-6193 > Project: NetBeans > Issue Type: Bug > Components: php - Editor > Affects Versions: 12.5 > Reporter: Junichi Yamamoto > Assignee: Junichi Yamamoto > Priority: Major > Labels: pull-request-available > Fix For: NB13 > > Time Spent: 50m > Remaining Estimate: 0h > > The following code is valid. However, if we use attributes with interface > constants and methods, syntax errors occur. > Example code: > {code:php} > <?php > #[I1] > interface I { > #[I2(1)] // syntax error occurs > public const I_CONST = "interface"; > #[I3] // syntax error occurs > public function method(#[I4] $param1, #[I5(), I6("test")] $param): void; > // syntax error occurs > } > $refI = new \ReflectionClass(I::class); > $sourcesI = [ > $refI, > $refI->getReflectionConstant('I_CONST'), > $refI->getMethod('method'), > $refI->getMethod('method')->getParameters()[0], > $refI->getMethod('method')->getParameters()[1], > ]; > foreach ($sourcesI as $r) { > $attr = $r->getAttributes(); > var_dump(get_class($r), count($attr)); > foreach ($attr as $a) { > var_dump($a->getName(), $a->getArguments()); > } > echo "\n"; > }{code} > Result: > string(15) "ReflectionClass" > int(1) > string(2) "I1" > array(0) { > } > string(23) "ReflectionClassConstant" > int(1) > string(2) "I2" > array(1) { > [0]=> > int(1) > } > string(16) "ReflectionMethod" > int(1) > string(2) "I3" > array(0) { > } > string(19) "ReflectionParameter" > int(1) > string(2) "I4" > array(0) { > } > string(19) "ReflectionParameter" > int(2) > string(2) "I5" > array(0) { > } > string(2) "I6" > array(1) { > [0]=> > string(4) "test" > } > Steps to reproduce: > # Create a PHP project > # Create a new file > # Copy and paste the above example code -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists