Re: [PHP-DEV] [RFC][Under discussion] Fetch properties in const expressions

2022-06-27 Thread Marc Bennewitz
On 24.06.22 23:55, Larry Garfield wrote: On Fri, Jun 24, 2022, at 11:43 AM, Nicolas Grekas wrote: Hi everyone I'd like to start a discussion on a simple RFC to allow fetching properties in constant expressions. https://wiki.php.net/rfc/fetch_property_in_const_expressions The RFC proposes add

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-27 Thread Rowan Tommins
On 27/06/2022 07:29, Michał Marcin Brzuchalski wrote: CurlUrl is for me is a mix of Url/Uri object properties well known from other userland implementations like the PSR one with Uri specific like the host, scheme, port, path, query, fragment, etc. but on the other hand, we have flags and options

Re: [PHP-DEV] [RFC][Under discussion] Fetch properties in const expressions

2022-06-27 Thread Rowan Tommins
On 27/06/2022 08:38, Marc Bennewitz wrote: Now as I have a lot of such classes and I want to make sure all of the prefixes are unique so I added an enum with all prefixes and use the enum value as constant value as well. enum IdPrefix:string {     case USER_ID = 'u-';     // ... } This wou

Re: [PHP-DEV] [RFC] [Under Discussion] Auto-implement Stringable for string backed enums

2022-06-27 Thread Guilliam Xavier
>> Symfony YAML has a `!php/const X` feature, which also works when X is >> an Enum::CASE; how about a `!php/enum_value` feature? > > I submitted something similar today at > https://github.com/symfony/symfony/pull/46771 And I see that it has been merged ;) >> Otherwise, I also like Rowan's sugg

Re: [PHP-DEV] [RFC][Under discussion] Fetch properties in const expressions

2022-06-27 Thread Robert Landers
On Mon, Jun 27, 2022 at 10:16 AM Rowan Tommins wrote: > > On 27/06/2022 08:38, Marc Bennewitz wrote: > > Now as I have a lot of such classes and I want to make sure all of the > > prefixes are unique so I added an enum with all prefixes and use the > > enum value as constant value as well. > > > >

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-27 Thread Pierrick Charron
Hi Michał, Thanks for your comments. You made me realise that the RFC missed information on a crucial part which is the new CURLOPT_CURLU option that tells curl to use the CurlUrl object instead of the "standard" CURLOPT_URL option. I just added some information on it in the RFC. The purpose of t

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-27 Thread Pierrick Charron
Hi Rowan > > Rather than a *representation* of a URL, think of the class as a > *builder* for URLs. There are multiple methods because you might want to > build the URL in different orders ("start with this URL but replace the > port", "start with this domain and I'll add the path later", etc). Al

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-27 Thread Rowan Tommins
On 27/06/2022 14:10, Pierrick Charron wrote: The purpose of the CurlUrl class is to be able to build/see/modify an URL as it is seen by libcurl before/after passing it to your CurlHandle. It is not meant to be used alone as a representation of an URL. For example, you may want to do some checks

Re: [PHP-DEV] [RFC] [Under Discussion] Auto-implement Stringable for string backed enums

2022-06-27 Thread Larry Garfield
On Wed, Jun 22, 2022, at 12:26 PM, Larry Garfield wrote: > So I am firmly against making it easier to (mis)use enums in a > situation where constants are already the superior solution by every > metric. The only argument I see is making case 1, transitioning from a > string to an enum for a ge

Re: [PHP-DEV] [RFC] [Under Discussion] Auto-implement Stringable for string backed enums

2022-06-27 Thread Rowan Tommins
On 27/06/2022 13:03, Guilliam Xavier wrote: Reminded me of e.g. https://stackoverflow.com/questions/6422380/does-any-programming-language-support-defining-constraints-on-primitive-data-types (mainly integer ranges, but the concept of "domains" looks similar) Yes, I'm vaguely familiar with the

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-27 Thread Pierrick Charron
Hi Rowan > If I've got a URL, which is already a string, what code would I write to > "do some checks" on it, outside of a unit test? > That's just an example with an old version of PHP, but let's say you have some code that makes requests but only to a specific list of servers, so you want to a

[PHP-DEV] Re: [RFC] [VOTE] Random Extension 5.x

2022-06-27 Thread Go Kudo
2022年6月14日(火) 9:01 Go Kudo : > Hello internals. > > Voting began on 2022-06-14 00:00:00 (UTC) and will end on 2022-06-28 > 00:00:00 (UTC). > > https://wiki.php.net/rfc/rng_extension > > The implementation is not yet complete and has some issues. > See TODO in Pull Request for details. > > https://