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

Thank you all for your answers. They're very clarifying.

I must admit that discovering type declarations in PHP has changed my mind with 
regard to this potential hint (and others). I agree that, without types in the 
function parameters and returns, this hint would be useless once you crossed 
the boundary of a function. But explicit types allow a much more stricter 
analysis.

There would still be corner cases, of course. For example, if you don't use 
namespaces and declare 2 classes with the same name in your code base (in 2 
different files). Wherever you instantiate any of these classes and call one of 
its methods, the analyzer will have to decide between:

* Either consider any method of that instance as existing (too lax).
* Or consider any method of that instance as non-existing (too strict).
* Or generate something like an intersection type in memory and consider 
methods of both classes as existing.

If I'm not mistaken, the PHP plugin of IntelliJ and the Intelephense plugin of 
Visual Studio Code have chosen the 3rd route.

I wish I had a deep knowledge about language analysis and, specially, the 
Netbeans internals (to help with this). But my knowledge is limited to Java 
back-end apps only :-/ .


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

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to