Re: PHP socket ethernet support - step 2

From: Date: Tue, 04 Mar 2025 22:18:01 +0000
Subject: Re: PHP socket ethernet support - step 2
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Monday, 3 March 2025 at 21:20, Jakub Zelenka <[email protected]> wrote:

> Hi,
>
>> I am working on the second pass of this feature and write here because of the legitimate
>> concern regarding new classes to add.
>>
>> [PR here](https://github.com/php/php-src/pull/17926)
>
> For those that want to quickly see the actually classes, here is a stub link: https://github.com/php/php-src/pull/17926/files#diff-190e64a9475f39f2b575e6032d6539b504b33fe534965e5bb3512fe430fe1846
>
>> I agree also on adding a namespace on top (Sockets ?) and changing the class names.
>
> I think it would be good to note that there are already two classes defined in socket
> extension:
>
> final class Socket
> {
> }
>
> final class AddressInfo
> {
>
> }
>
> So it might look a bit strange if those two are not namespaced and the new ones are. The
> AddressInfo is a bit unfortunate name though. The namespace seems cleaner but not sure if prefix
> would be more consistent. Although having SocketPacket is not exactly nice so probably Socket\Packet
> is better. But I don't really mind. I would just really prefer to not introduce those classes
> without namespace or prefix.

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.

Best regards,
Gina P. Banyard

[1] https://wiki.php.net/rfc/namespaces_in_bundled_extensions

>


Thread (7 messages)

« previous php.internals (#126565) next »