Hi,

I think this proposal has been made before maybe here or discussed
elsewhere.  Still, I'd like to give my input on the idea.

The basic concept is when a method has the internal access modifier, it can
only be called from within the same namespace.

The case for this is to protect classes from being used in ways unintended,
while still allowing classes within the same namespace to interact with
each other non-api methods.

I've created a commit:
https://github.com/orolyn/php-src/commit/2ddec7149c308a80b33653da31b5ba214f679bb8

Please forgive any mistakes, it is a proof of concept and just complete
enough to fulfil the feature.

Currently, a limitation is internal methods can only be called from within
another scope in the same namespace, as opposed to outside a class.

For this implementation I needed to store the namespace of the class during
the declaration, so to test that I added the function get_class_namespace
to help me iron out some bugs.  I have left the function there.

Thank you,
Dominic

Reply via email to