Hi
On 3/4/25 23:18, Gina P. Banyard wrote:
Those two classes predate the Namespaces in bundled PHP extensions [1] RFC, I
do think adding a namespace is better.
And we could also move the two classes into the new namespace and add class
aliases for the global ones, considering they are quite recent additions to PHP.
I agree that adding a namespace would be appropriate here. Looking at
the sockets.stub.php, it pollutes the global namespace quite a bit. I
probably miscounted, but it appears to be at least 10 different prefixes
for the global constants.
It would probably be in order to also alias all the constants into the
namespace (possibly converting them to enums where appropriate) and then
in a follow-up version deprecate the global ones. I think that would
bring quite a bit of positive impact, for minimal effort.
--------
As for the classes themselves: It does not appear to be defined in our
naming policy [1], but the properties should likely use camel-case, as
that is the established convention for userland code. And I'm also
curious why the port properties are strings, not ints? And what is the
payload object, is that just stdClass?
Best regards
Tim Düsterhus
[1]
https://github.com/php/policies/blob/main/coding-standards-and-naming.rst