On Tue, 4 Mar 2025 at 22:34, Tim Düsterhus <t...@bastelstu.be> wrote:

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

Ok I ll go the namespace route then, fair point.

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

Yes it is a definition mistake it means to be a int indeed.


> And what is the
> payload object, is that just stdClass?
>

 Not really it's supposed to be one of the new classes.

>
> Best regards
> Tim Düsterhus
>
> [1]
> https://github.com/php/policies/blob/main/coding-standards-and-naming.rst
>

Reply via email to