[Discussion] "Internal" attribute and warning
| From: | Robert Landers | Date: | Sat, 18 May 2024 14:00:25 +0000 |
| Subject: | [Discussion] "Internal" attribute and warning | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-123346@lists.php.net to get a copy of this message | ||
Hello internals,
I've been thinking about having an "internal" attribute that will emit
a warning if called from outside it's left-most namespace.
It might look something like this:
namespace MyCompany\PackageA {
#[\Internal] function doStuff() {}
}
namespace OtherCompany\PackageB {
\MyCompany\PackageA\doStuff(); // warning emitted
}
namespace MyCompany\PackageB {
\MyCompany\PackageB\doStuff(); // left-most part of namespace
matches, no warning
}
This would allow for library maintainers to mark internal constructs
as such and provide users with feedback that they are using code that
may be changed without any notice.
Any thoughts?
Robert Landers
Software Engineer
Utrecht NL