apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.62k stars 841 forks source link

Hack {$variable} is not accepted as valid construction #7249

Open VaclavMacurek opened 4 months ago

VaclavMacurek commented 4 months ago

Apache NetBeans version

Apache NetBeans 21

What happened

I use PHP's variable hack {$variable} in case when I need to use - but I found that this hack is not accepted as valid construction, at least in some cases.

I wanted to use this construction

$this -> result[$key] = {$this -> used_function}($this -> checked_string, $expression);

to produce code like (that is part of very simple class for massive validation based on regular expressions)

$this -> result[$name] = any_function($this -> checked_string, $expression);

but Netbeans sees code with hack {$variable} as invalid - and marks it by red colour. But it is a very strange, because in else case (writen below) it was accepted as valid.

CalendarCheck::{$this -> calendar_check_method}($index_of_years)

It is a very problematic, if one feature is accepted in some cases - and not in else cases. It would be very good if this could be corrected.

Language / Project Type / NetBeans Component

PHP

How to reproduce

How to reproduce this issue is described in section "What happened".

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11, 64bit (originally Windows 10, 64 bit)

JDK

BellSoft LibericaJDK-21 (originally Oracle JRE 8)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

How it looks in case if hack is not accepted HackIsNotAccepted How it looks in case if hack is accepted HackIsAccepted

It seems like it is a (known) bug of PHP, not issue of NetBeans.

Are you willing to submit a pull request?

No

junichi11 commented 2 months ago

@VaclavMacurek Could you write an executable example to reproduce it?