Replies: 2 comments 7 replies
-
You assume, that NetBeans "knows" about your runtime environment, but that is not the case. You can install extensions outside your project and these can make global function available to your code. So there is a high risk to cause false positives for such warnings. |
Beta Was this translation helpful? Give feedback.
-
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:
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 :-/ . |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi:
I've created a PHP project from scratch, in NetBeans 26. I'm editing a single PHP file (a very simple one), and I was wondering if a call to an undefined function shouldn't trigger an error in the editor (or a warning at least). For example, consider this piece of code:
I understand that
foo()
may or may not exist in the global space but, Doesn't Netbeans scan the whole project to discover which declarations are made in each space?Thank you.
Beta Was this translation helpful? Give feedback.
All reactions