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 Hi Matthias. Thank you for your response.

I've not programmed in PHP since the days of version 5.2, I believe. Back then, 
there was no way to declare the dependencies of our projects (or at least I 
didn't know any), so the policy that you talk about made much sense. But I 
wonder if, now that we've tools like Composer, it wouldn't make more sense that 
a reference to an undefined function cause at least a warning, so that the user 
is aware that either he has mistyped the name or that he has not added the 
proper dependency to `composer.json`.

I know that using Composer is not mandatory for a PHP project (I myself am 
still trying to incorporate it to my project), but if the mentioned warning 
could be toggled on/off (like others in Netbeans), we could choose according to 
the nature of each project.

Apart from this case, there are other 2 cases about which I've doubts:

* References to undefined fields.
* References to undefined methods.

For example, if I write this within a method of my class:

```php
self::foo();   // Nonexistent static method.
$this->foo;    // Nonexistent field.
$this->foo();  // Nonexistent method.
```

Shouldn't the editor emit 3 warnings?

I apologize in advance if I'm misunderstanding all this.

Thank you.


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

----
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