GitHub user negora added a comment to the discussion: PHP: Shouldn't a call to 
an undefined function trigger an error in the editor?

@matthiasblaesing Good point. To be honest, I didn't know the constructions 
with `__call` and `__callStatic`. However, I still believe that a warning would 
make more good than harm. For example, in my examples I'm calling a 
field/method from the class itself (I'm using `$this`; `self` for static 
members). This is a class that I myself am declaring, so I (and the IDE) know 
for sure that such field/method doesn't exist. Why would I want to call an 
undefined member, on purpose, from the inside of the class? Even if the class 
were inheriting from another one, the IDE would know the type of the parent 
class (present in the `extends`) and could also know if the member exists or 
not.

In addition to all this, and in contrast to the 5 series, PHP added type 
declarations (a game-changer for static analysis) and even [it deprecated 
dynamic property 
declarations](https://php.watch/versions/8.2/dynamic-properties-deprecated) 
(present in your example), except for cases where we explicitly need dynamic 
objects. So, with the current state of PHP (and adding Composer to the mix), 
Isn't it more probable that a reference to an undefined member is a mistake and 
not made on purpose?


GitHub link: 
https://github.com/apache/netbeans/discussions/8573#discussioncomment-13458329

----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@netbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to