Re: [PHP-DEV] [RFC] [Discussion] Clone with

2023-05-30 Thread Alexandru Pătrănescu
On Wed, May 31, 2023 at 2:53 AM Larry Garfield wrote: > On Tue, May 30, 2023, at 10:04 PM, Alexandru Pătrănescu wrote: > > On Tue, May 30, 2023, 19:39 Larry Garfield > wrote: > > > >> On Mon, May 29, 2023, at 11:22 PM, Máté Kocsis wrote: > >> > To be honest, the current behavior seemed like the

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
> On 30.5.2023, at 21:56, Andreas Hennings wrote: > > On Tue, 30 May 2023 at 19:25, Boro Sitnikovski wrote: >> >> Here's some more examples: >> >> 1. Use `array_group` to create list of singleton list: >> ``` >> $groups = array_group( $arr, function( $p1, $p2 ) { >> return false; >> } ); >>

Re: [PHP-DEV] [RFC] [Discussion] Clone with

2023-05-30 Thread Larry Garfield
On Tue, May 30, 2023, at 10:04 PM, Alexandru Pătrănescu wrote: > On Tue, May 30, 2023, 19:39 Larry Garfield wrote: > >> On Mon, May 29, 2023, at 11:22 PM, Máté Kocsis wrote: >> > To be honest, the current behavior seemed like the natural choice for >> > me, and I didn't really consider to execute

Re: [PHP-DEV] [RFC] [Discussion] Clone with

2023-05-30 Thread Alexandru Pătrănescu
On Tue, May 30, 2023, 19:39 Larry Garfield wrote: > On Mon, May 29, 2023, at 11:22 PM, Máté Kocsis wrote: > > To be honest, the current behavior seemed like the natural choice for > > me, and I didn't really consider to execute the __clone() method after > the > > clone assignments. > > Do you ha

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 22:45, Larry Garfield wrote: > > On Tue, May 30, 2023, at 7:34 PM, Andreas Hennings wrote: > > On Tue, 30 May 2023 at 19:12, Larry Garfield wrote: > >> > >> I've run into this issue in my attribute library as well > >> (https://github.com/Crell/AttributeUtils). What I do

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Larry Garfield
On Tue, May 30, 2023, at 7:34 PM, Andreas Hennings wrote: > On Tue, 30 May 2023 at 19:12, Larry Garfield wrote: >> >> I've run into this issue in my attribute library as well >> (https://github.com/Crell/AttributeUtils). What I do there is allow >> attributes to opt-in to a callback method via

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 19:12, Larry Garfield wrote: > > I've run into this issue in my attribute library as well > (https://github.com/Crell/AttributeUtils). What I do there is allow > attributes to opt-in to a callback method via interface. For example: > > #[\Attribute] > class AttribWithNam

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
> On 30.5.2023, at 19:21, Larry Garfield wrote: > > On Tue, May 30, 2023, at 4:27 PM, Boro Sitnikovski wrote: >> Hi, >> >> Thank you for your thoughts. >> >>> I would say the more common desired behavior is the one in your first >>> example. And even for that we don't have a native function.

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
Hi, > On 30.5.2023, at 18:33, Andreas Hennings wrote: > > On Tue, 30 May 2023 at 18:27, Boro Sitnikovski wrote: >> >> Hi, >> >> Thank you for your thoughts. >> >>> I would say the more common desired behavior is the one in your first >>> example. And even for that we don't have a native func

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Larry Garfield
On Tue, May 30, 2023, at 4:27 PM, Boro Sitnikovski wrote: > Hi, > > Thank you for your thoughts. > >> I would say the more common desired behavior is the one in your first >> example. And even for that we don't have a native function. > > This Google search might give more insight into the number o

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-30 Thread Larry Garfield
-- Larry Garfield la...@garfieldtech.com On Mon, May 29, 2023, at 8:28 PM, Claude Pache wrote: >> Le 8 mai 2023 à 23:38, Larry Garfield a écrit : >> >> Ilija Tovilo and I would like to offer another RFC for your consideration. >> It's been a while in coming, and we've evolved the desig

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Larry Garfield
On Tue, May 30, 2023, at 2:49 PM, Andreas Hennings wrote: > On Tue, 30 May 2023 at 15:14, Stephen Reay wrote: >> >> (Resending to the list without all the history because qmail complained >> about message size) >> >> >> >> >> >> Hi Andreas, >> >> >> >> I too have wondered (and I think asked in ro

Re: [PHP-DEV] [RFC] [Discussion] Clone with

2023-05-30 Thread Tim Düsterhus
Hi On 5/30/23 18:37, Larry Garfield wrote: To be honest, the current behavior seemed like the natural choice for me, and I didn't really consider to execute the __clone() method after the clone assignments. Do you have a use-case in mind when you need to forward-pass information to __clone()?

Re: [PHP-DEV] Let ReflectionMethod keep track of original class

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 18:48, Larry Garfield wrote: > > > > -- > Larry Garfield > la...@garfieldtech.com > > On Tue, May 30, 2023, at 2:42 AM, Andreas Hennings wrote: > > Hello list, > > this proposal will be useful in combination with "Declaration-aware > > attributes" > > > > > > Problem >

Re: [PHP-DEV] Let ReflectionMethod keep track of original class

2023-05-30 Thread Larry Garfield
-- Larry Garfield la...@garfieldtech.com On Tue, May 30, 2023, at 2:42 AM, Andreas Hennings wrote: > Hello list, > this proposal will be useful in combination with "Declaration-aware > attributes" > > > Problem > > Currently, ReflectionMethod is not aware of the original class, i

Re: [PHP-DEV] [RFC] [Discussion] Clone with

2023-05-30 Thread Larry Garfield
On Mon, May 29, 2023, at 11:22 PM, Máté Kocsis wrote: > Hi Michał and Larry, > > As Tim has already clarified, using literal strings in the left-hand side > of "clone with expressions" won't cause any issues > for IDEs and static analysers to identify the correct property. I got rid > of the shorth

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 18:27, Boro Sitnikovski wrote: > > Hi, > > Thank you for your thoughts. > > > I would say the more common desired behavior is the one in your first > > example. And even for that we don't have a native function. > > This Google search might give more insight into the number

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
Hi, Thank you for your thoughts. > I would say the more common desired behavior is the one in your first > example. And even for that we don't have a native function. This Google search might give more insight into the number of discussions about a grouping functionality: https://www.google.co

Re: [PHP-DEV] Deprecation of the formats DATE_ISO8601 and DATE_RFC7231

2023-05-30 Thread Hans Henrik Bergan
>In my opinion, deprecating this does not do anything besides annoying users. In my opinion, since it isn't, and likely never was, a legal ISO8601 string, it's a no-brainer that it should be deprecated. (it's at least been illegal since iso8601:2004 released in 2004) On Fri, 26 May 2023 at 12:17,

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Andreas Hennings
Here we go, https://3v4l.org/KsL3o function array_group(array $arr1, callable $compare): array { $groups = []; $group = []; $prev = NULL; foreach ($arr1 as $value) { if ($group && !$compare($prev, $value)) { $groups[] = $group; $group = [];

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Andreas Hennings
Thank you, this clarifies and it confirms my initial assumption of what you are proposing. So you want to slice an array by comparing adjacent values. My personal feedback: I think the need for the grouping behavior you describe is not common enough that it needs its own native function. I would

Re: [PHP-DEV] [RFC] [Discussion] PHP 8.3 deprecations

2023-05-30 Thread Tim Düsterhus
Hi On 5/30/23 17:52, Go Kudo wrote: > It should be deprecated with PHP 8.4 at the earliest to give folks at least Indeed, I agree that `lcg_value()` should be deprecated at least in PHP 8.4. However, `lcg_value()` remains a dangerous function. It still has a weak initial seeding problem (PID

Re: [PHP-DEV] [RFC] [Discussion] PHP 8.3 deprecations

2023-05-30 Thread Go Kudo
2023年5月30日(火) 4:49 Tim Düsterhus : > Hi > > On 5/29/23 08:44, Go Kudo wrote: > > I realized I was about to add the deprecation of `lcg_value()` and forgot > > to do so, so I added it. > > > > https://wiki.php.net/rfc/deprecations_php_8_3#global_combined_lcg > > > > As usual, my English is of low q

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
Hey, Thanks for the suggestion. For the previous case in the code, I added these in a Gist to not clutter here too much: 1. The first example corresponds to https://gist.github.com/bor0/b5f449bfe85440d96abd933b9f03b310#file-test_manual_group-php 2. The second example corresponds to https://gi

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Andreas Hennings
Hello Boro, I think you should include the "expected result" in your code examples. Maybe this is in your patch file, but I don't think we want to look at that for discussion. Cheers Andreas On Tue, 30 May 2023 at 13:35, Boro Sitnikovski wrote: > > Hello all, > > As per the How To Create an RFC

Re: [PHP-DEV] [RFC] [Discussion] PHP 8.3 deprecations

2023-05-30 Thread Tim Düsterhus
Hi On 5/29/23 17:41, Nikita Popov wrote: I don't think we should deprecate mt_rand(). There are plenty of use-cases that require neither a seedable (predictable) RNG sequence, nor a cryptographically-secure RNG. For those use-cases (and especially one-off uses), mt_rand() is perfect, and goin

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 15:14, Stephen Reay wrote: > > (Resending to the list without all the history because qmail complained about > message size) > > > >> > >> Hi Andreas, > >> > >> I too have wondered (and I think asked in room11?) about such a concept. > >> >From memory the general response

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Stephen Reay
(Resending to the list without all the history because qmail complained about message size) >> >> Hi Andreas, >> >> I too have wondered (and I think asked in room11?) about such a concept. >> >From memory the general response was “just do it in userland with a >> wrapper” so its good to see

[PHP-DEV] Re: [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
Updated the patch: added a test about increasing subsequences example, and a minor bugfix. array_group.patch Description: Binary data On 30.5.2023, at 13:34, Boro Sitnikovski wrote:Hello all,As per the How To Create an RFC instructions, I am sending this e-mail in order to get your feedback on my

Re: [PHP-DEV] RFC [Discussion]: Marking overridden methods (#[\Override])

2023-05-30 Thread Rowan Tommins
On 29/05/2023 19:29, Tim Düsterhus wrote: I think this is a flawed premise: Any sort of analysis that PHP itself performs can also be performed in userland. This isn't actually true. There is a lot of dynamic functionality in PHP where correctness can't be proven ahead of time, and run-time

Re: [PHP-DEV] Declaration-aware attributes

2023-05-30 Thread Andreas Hennings
On Tue, 30 May 2023 at 05:22, Stephen Reay wrote: > > > > > On 30 May 2023, at 07:48, Andreas Hennings wrote: > > > > Hello internals, > > I am picking up an idea that was mentioned by Benjamin Eberlei in the past. > > https://externals.io/message/110217#110395 > > (we probably had the idea indep

[PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-05-30 Thread Boro Sitnikovski
Hello all,As per the How To Create an RFC instructions, I am sending this e-mail in order to get your feedback on my proposal.I propose introducing a function to PHP core named `array_group`. This function takes an array and a function and returns an array that contains arrays - groups of consecuti

Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures

2023-05-30 Thread Claude Pache
Hi Máté, > Le 30 mai 2023 à 01:41, Máté Kocsis a écrit : > > Hi Claude, > >> The replacement methods for IntlCalendar::set() (namely >> IntlCalendar::setDate() and IntlCalendar::setDateTime()) must not have a >> return type of `void`, but `true`, like the original method, for the two >> foll