Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Nick
Hey internals, > On 4. Jun 2025, at 20:19, Nick wrote: >> I believe at the moment that RFC text is all there is. :-) I don't know >> that it's worth opening a discussion without at least a mostly-done >> implementation. Also, Ilija is rather busy on other tasks at the moment, as >> am I. (U

Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Nick
Hey Tim, > On 4. Jun 2025, at 21:09, Tim Düsterhus wrote: > > Semantically once you involved inheritance it isn't that easy. It is allowed > to override an “unhooked” property with a hooked property and in the > “Readonly Amendments” RFC we already decided that inheriting from a > `readonly`

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Rob Landers
On Mon, Jun 2, 2025, at 18:27, Gina P. Banyard wrote: > Hello internals, > > This is the second RFC out of a set of type system related RFCs I want to > propose for PHP 8.5. > > The objective is to fix a weird quirk of PHP's type system, where void lives > in its own type hierarchy. > This is

Re: [PHP-DEV] Allowing class properties to remain Uninitialized as a default value.

2025-06-04 Thread Bradley Hayes
Here is another way to think about it, trying to make the arguments optional not have a new value type. Optional arguments currently requires a default value. Assigning values to properties is truly optional but we cant reflect this in the constructor parameters. class DTO { public function

Re: [PHP-DEV] Allowing class properties to remain Uninitialized as a default value.

2025-06-04 Thread Bradley Hayes
Hey Claude, i did think of the same thing you proposed and I cover that in the gihub issue I linked to. This doesnt replicate the uninitialized state. Doing ti with custom classes or enums means now not only are forced to manually check each property everywhere it might be used you also have to wr

[PHP-DEV][DISCUSSION] grapheme_* functions adds locale in parameter (or any?)

2025-06-04 Thread youkidearitai
Hi, Internals I would like adds locale parameter that already there are grapheme_* functions. Because Unicode is locale-dependency but grapheme_* functions is not locale-dependency. For example, Add $locale parameter is below. ``` grapheme_extract( string $haystack, int $size, int $ty

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Daniel Scherzer
On Wed, Jun 4, 2025 at 4:49 PM Bob Weinand wrote: > On 4.6.2025 22:39:28, Daniel Scherzer wrote: > > On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: > >> >> On 4.6.2025 16:54:05, Bob Weinand wrote: >> > On 2.6.2025 18:27:51, Gina P. Banyard wrote: >> >> Hello internals, >> >> >> >> This is the

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 4.6.2025 22:39:28, Daniel Scherzer wrote: On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: On 4.6.2025 16:54:05, Bob Weinand wrote: > On 2.6.2025 18:27:51, Gina P. Banyard wrote: >> Hello internals, >> >> This is the second RFC out of a set of type system related RFCs I

Re: [PHP-DEV] [VOTE] Clone with v2

2025-06-04 Thread Volker Dusch
On Wed, Jun 4, 2025 at 5:49 PM Nicolas Grekas wrote: > While I appreciate the effort that went into the proposal and I value the > technical discussions we've had, I feel the transition to the voting phase > comes a bit too soon. It seemed like the conversation still had room to > evolve, and see

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Daniel Scherzer
On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: > > On 4.6.2025 16:54:05, Bob Weinand wrote: > > On 2.6.2025 18:27:51, Gina P. Banyard wrote: > >> Hello internals, > >> > >> This is the second RFC out of a set of type system related RFCs I > >> want to propose for PHP 8.5. > >> > >> The objecti

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 2.6.2025 18:27:51, Gina P. Banyard wrote: Hello internals, This is the second RFC out of a set of type system related RFCs I want to propose for PHP 8.5. The objective is to fix a weird quirk of PHP's type system, where void lives in its own type hierarchy. This is visible mainly in that a

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Bob Weinand
On 4.6.2025 18:46:58, Larry Garfield wrote: On Wed, Jun 4, 2025, at 11:16 AM, Theodore Brown wrote: On Wed, June 4, 2025 at 09:37 Aleksander Machniak wrote: On 4.06.2025 16:03, G. P. Banyard wrote: I don't understand what you mean. The purpose is to deprecate the behaviour in 8.5 so that it c

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Larry Garfield
On Wed, Jun 4, 2025, at 11:16 AM, Theodore Brown wrote: > On Wed, June 4, 2025 at 09:37 Aleksander Machniak wrote: > >> On 4.06.2025 16:03, G. P. Banyard wrote: >>> I don't understand what you mean. >>> The purpose is to deprecate the behaviour in 8.5 so that it can be removed >>> in PHP 9. >>> We

Re: [PHP-DEV] [VOTE] Clone with v2

2025-06-04 Thread Larry Garfield
On Wed, Jun 4, 2025, at 10:48 AM, Nicolas Grekas wrote: > Le mer. 4 juin 2025 à 17:15, Volker Dusch a écrit : >> Hi everyone, >> >> We just opened the vote for the "Clone with v2" RFC: >> >> RFC: https://wiki.php.net/rfc/clone_with_v2 >> Discussion: https://externals.io/message/127353 >> PR: htt

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Theodore Brown
On Wed, June 4, 2025 at 09:37 Aleksander Machniak wrote: > On 4.06.2025 16:03, G. P. Banyard wrote: >> I don't understand what you mean. >> The purpose is to deprecate the behaviour in 8.5 so that it can be removed >> in PHP 9. >> We try to not break behaviour with no prior warning. >> Could you

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 4.6.2025 16:54:05, Bob Weinand wrote: On 2.6.2025 18:27:51, Gina P. Banyard wrote: Hello internals, This is the second RFC out of a set of type system related RFCs I want to propose for PHP 8.5. The objective is to fix a weird quirk of PHP's type system, where void lives in its own typ

Re: [PHP-DEV] [VOTE] Clone with v2

2025-06-04 Thread Nicolas Grekas
Le mer. 4 juin 2025 à 17:15, Volker Dusch a écrit : > Hi everyone, > > We just opened the vote for the "Clone with v2" RFC: > > RFC: https://wiki.php.net/rfc/clone_with_v2 > Discussion: https://externals.io/message/127353 > PR: https://github.com/php/php-src/pull/18747 > > As with every RFC, a 2/

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Aleksander Machniak
On 4.06.2025 16:03, Gina P. Banyard wrote: I don't understand what you mean. The purpose is to deprecate the behaviour in 8.5 so that it can be removed in PHP 9. We try to not break behaviour with no prior warning. Could you clarify what you mean? I meant to move the deprecation to PHP 9.0. I

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

2025-06-04 Thread Nicolas Grekas
Hi Le mer. 4 juin 2025 à 15:33, Tim Düsterhus a écrit : > Hi > > Am 2025-06-03 16:24, schrieb Nicolas Grekas: > > - We decided to __clone before updating properties to avoid BC issues. > >> > > > > Not sure which BC issues you've in mind, especially as that's a new > > feature. > > As I see it,

[PHP-DEV] [VOTE] Clone with v2

2025-06-04 Thread Volker Dusch
Hi everyone, We just opened the vote for the "Clone with v2" RFC: RFC: https://wiki.php.net/rfc/clone_with_v2 Discussion: https://externals.io/message/127353 PR: https://github.com/php/php-src/pull/18747 As with every RFC, a 2/3 majority is required. Voting ends 2025-06-18 at 15:30:00 UTC. Kind

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Gina P. Banyard
On Wednesday, 4 June 2025 at 14:32, Aleksander Machniak wrote: > On 2.06.2025 18:11, Gina P. Banyard wrote: > > > Let me know what you think about it. > > > > RFC: https://wiki.php.net/rfc/deprecate-function-bool-type-juggling > > > I would feel better if it targeted PHP9. Right now I'm on +0

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

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-03 16:24, schrieb Nicolas Grekas: - We decided to __clone before updating properties to avoid BC issues. Not sure which BC issues you've in mind, especially as that's a new feature. As I see it, before or after wouldn't change anything as far as __clone implementations are co

Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Nick
Hey Tim, > On 4. Jun 2025, at 21:09, Tim Düsterhus wrote: > > Hi > > Am 2025-06-04 14:19, schrieb Nick: >> Fair. If someone really wants to add random_int(): "well, that assumption >> doesn't hold anymore, deal” from my side. > > Semantically once you involved inheritance it isn't that easy.

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Aleksander Machniak
On 2.06.2025 18:11, Gina P. Banyard wrote: Let me know what you think about it. RFC: https://wiki.php.net/rfc/deprecate-function-bool-type-juggling I would feel better if it targeted PHP9. Right now I'm on +0 on this proposal. -- Aleksander Machniak Kolab Groupware Developer[https:/

Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context

2025-06-04 Thread Gina P. Banyard
On Tuesday, 3 June 2025 at 18:44, Rob Landers wrote: > On Tue, Jun 3, 2025, at 18:19, Gina P. Banyard wrote: > >> On Monday, 2 June 2025 at 22:05, Rob Landers wrote: >> >>> Further, this makes a ton of shorthand nearly impossible — the manual >>> casting to bool in strict mode is one of the mos

Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-04 14:19, schrieb Nick: Fair. If someone really wants to add random_int(): "well, that assumption doesn't hold anymore, deal” from my side. Semantically once you involved inheritance it isn't that easy. It is allowed to override an “unhooked” property with a hooked property and

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Gina P. Banyard
On Wednesday, 4 June 2025 at 09:50, Tim Düsterhus wrote: > Am 2025-06-03 17:42, schrieb Gina P. Banyard: > > > A type system should be logical, and the fact that the top type (mixed) > > is not a super-type of all types doesn't make any sense. > > > I do not consider `void` to be a type per se

Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Marc Bennewitz
Hi Larry, On 03.06.25 19:03, Larry Garfield wrote: On Mon, Jun 2, 2025, at 11:34 PM, Nick wrote: I would like to add, personally, I don’t believe the above is dumb: ```php class Dumb { public readonly int $value { get => $this->value * random_int(1, 100); } } ``` I think it is a legitimate u

Re: [PHP-DEV] Allow hooks in `readonly` promoted properties

2025-06-04 Thread Nick
Hey all, > On 4. Jun 2025, at 01:03, Larry Garfield wrote: > > It's about expectation setting. If you see a property marked `readonly`, > it's reasonable to expect this to be true: > > $foo->bar == $foo->bar; > > For a traditional field (pre-hooks), this would be trivially true. With > hoo

Re: [PHP-DEV] Allowing class properties to remain Uninitialized as a default value.

2025-06-04 Thread Claude Pache
> Le 3 juin 2025 à 06:22, Bradley Hayes a écrit : > > Uninitialized properties are really useful. > Being skipped in foreach loops and JSON encoded results and other behaviours > around uninitialized properties save a lot of time wasted on basic checks and > uncaught logical mistakes around n

Re: [PHP-DEV] RFC: Single-Expression functions

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-05-22 11:24, schrieb Dmitry Derepko: I hope this message finds you well. I would like to respectfully propose single-expression functions for PHP: https://wiki.php.net/rfc/single-expression-functions Thank you for updating the RFC to match the template. I've read through it and ha

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-03 17:46, schrieb Gina P. Banyard: > IMO, these checks are useful enough not to be removed. I agree with Ilija (and also Rowan). Well, I'm not sure Ilija and Rowan agree between each other. I believe they agree in that the distinction between `void` and `null` is a useful one

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-03 17:42, schrieb Gina P. Banyard: A type system should be logical, and the fact that the top type (mixed) is not a super-type of all types doesn't make any sense. I do not consider `void` to be a type per se, but rather as an indicator for the absence of a value. Basically the