Extending type-hinting for PHP

后端 未结 2 920
野趣味
野趣味 2021-02-19 19:20

Is it possible to extend the type-hinting with another documentor tag in Netbeans?

I\'m looking for a way to extend the type-hinting with a @scope tag that

2条回答
  •  醉话见心
    2021-02-19 20:11

    In the past (older versions of NetBeans) the type-hinting was showing all the methods from a class (of which object was in use), i.e. all public, protected, private and even static methods. Now, in new releases of NetBeans, this bug was fixed and when type-hinting on the object only the accessible methods/properties are type-hinted.

    This is simply just because Your template cannot access/call private property/method of a class as well as if You have an object (instance of a class) You shouldn't be able to access/call it's class's static properties/methods.

    The same applies if You are willing to type-hint inside of the class - now the type-hinting lists all the public, protected and private methods for $this->| (| is the cursor) while the static properties and methods are still not listed. On the other side, if You are type-hint on MyClass::| now only the static properties/methods are listed and again, when inside the MyClass class all the public, protected and public ones are listed while when accessing from outside the private ones are (very correctly) missing in the list.

    So the functionality You are requesting is wrong and denies the correct principles of encapsulation.

提交回复
热议问题