Re: [PHP-DEV] Policy for procedural style in new additions

2021-06-03 Thread Christian Schneider
Am 03.06.2021 um 22:47 schrieb Kamil Tekiela :I love this idea. We should definitely make it official that procedural > style API is unfavourable and should not be added to new classes. > On top of that, I would be in favor of deprecating all existing procedural > APIs. > - It's making it more dif

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Jordi Boggiano
On 03/06/2021 18:03, Timon de Groot wrote: On 3-6-2021 17:53, Ayesh Karunaratne wrote: Hi Timon, Thank you for this RFC. I think the `string|int $indent` approach is great 🚀! Reading the PR, it looks like `$indent=0` is essentially turning off pretty-print, which I think is intuitive. Basical

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Mike Schinkel
> On Jun 3, 2021, at 5:31 AM, Lauri Kenttä wrote: > > On 2021-06-03 01:59, Mike Schinkel wrote: >> 1.) Given Nikita's position that it would only be viable to offer a >> syntax that simulates method calling for arrays if the methods >> themselves are immutable can you envision a solution for allo

[PHP-DEV] PHP 8.0.7 Released

2021-06-03 Thread Sara Golemon
The PHP development team announces the immediate availability of PHP 8.0.7. This is a bugfix release. For source downloads of PHP 8.0.7 please visit our downloads page: https://www.php.net/downloads Windows source and binaries can be found at https://windows.php.net/download The list of changes is

Re: [PHP-DEV] Re: Policy for procedural style in new additions

2021-06-03 Thread Paul Crovella
On Thu, Jun 3, 2021 at 3:07 PM Christoph M. Becker wrote: > > I'd take a step at a time, and start with "prohibit introduction of new > dual APIs" only. > That sort of RFC doesn't really buy anything. It'd take a 2/3 vote to override it which is the same as what it'd take to introduce a dual API

[PHP-DEV] Re: Policy for procedural style in new additions

2021-06-03 Thread Christoph M. Becker
On 03.06.2021 at 20:28, Mel Dafert wrote: > After the RFC to add IntlDatePatternGenerator () was accepted, it was brought > up that the duplication of > procedural and OO style was not necessarily/useful anymore. > This already has some (old) precedent - in 2012, UConverter was added to > ext/in

Re: [PHP-DEV] Policy for procedural style in new additions

2021-06-03 Thread Kamil Tekiela
Hi Mel, I love this idea. We should definitely make it official that procedural style API is unfavourable and should not be added to new classes. On top of that, I would be in favor of deprecating all existing procedural APIs. - It's making it more difficult to maintain code in two variants - It's

[PHP-DEV] [VOTE] Pure intersection types

2021-06-03 Thread G. P. B.
Hello internals I've opened the vote for the "Pure intersection types" RFC: https://wiki.php.net/rfc/pure-intersection-types It will run for 2 weeks and end on the 17th of June 2021 Best regards, George P. Banyard

[PHP-DEV] Policy for procedural style in new additions

2021-06-03 Thread Mel Dafert
Hi internals, After the RFC to add IntlDatePatternGenerator () was accepted, it was brought up that the duplication of procedural and OO style was not necessarily/useful anymore. This already has some (old) precedent - in 2012, UConverter was added to ext/intl (https://wiki.php.net/rfc/uconverter

[PHP-DEV] [RFC][Draft] Add json_encode indent parameter

2021-06-03 Thread Timon de Groot
Hi internals, I'd like to present my RFC for adding the indent parameter to the json_encode function:   https://wiki.php.net/rfc/json_encode_indentation The `string|int $indent = 4` parameter adds the ability to specify the indentation for the JSON encoder. Amount of spaces can be specified b

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Timon de Groot
On 3-6-2021 17:53, Ayesh Karunaratne wrote: Hi Timon, Thank you for this RFC. I think the `string|int $indent` approach is great 🚀! Reading the PR, it looks like `$indent=0` is essentially turning off pretty-print, which I think is intuitive. Basically, yes. With `$indent=0`, no indentation will

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Ayesh Karunaratne
Hi Timon, Thank you for this RFC. I think the `string|int $indent` approach is great 🚀! Reading the PR, it looks like `$indent=0` is essentially turning off pretty-print, which I think is intuitive. Do you plan to add any sort of validation on negative integers? Perhaps throw a `\ValueError` exce

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Timon de Groot
On 3-6-2021 16:15, G. P. B. wrote: That's incorrect, as of PHP 8.0 Fast ZPP has a way to deal with the most common union types, including int|string. Best regards, George P. Banyard I found that STR_OR_LONG works fine, thanks for acknowledging! -- Kind regards, Timon de Groot -- PHP Inter

[PHP-DEV] PHP 7.4.20 Released!

2021-06-03 Thread Derick Rethans
The PHP development team announces the immediate availability of PHP 7.4.20. This is a bug fix release. All PHP 7.4 users are encouraged to upgrade to this version. For source downloads of PHP 7.4.20 please visit our downloads page. Windows binaries can be found on the PHP for Windows site. The l

Re: [PHP-DEV] [RFC] [Vote] Adding return types to internal methods

2021-06-03 Thread Nikita Popov
On Thu, Apr 22, 2021 at 9:42 AM Máté Kocsis wrote: > Hi Internals, > > I've just opened the vote about > https://wiki.php.net/rfc/internal_method_return_types > and I will close it on 2021-05-06. > > For prior discussion, please see https://externals.io/message/113413 > > Regards: > Máté > One i

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread G. P. B.
On Thu, 3 Jun 2021 at 11:49, Timon de Groot wrote: > On 3-6-2021 10:00, Jordi Boggiano wrote: > > I agree, but I'd make it accept a string|int much like JSON.stringify > > does, because that way you let people pass in tabs too, or "🚀" if > > that's how you want your JSON indented.. > > I like the

Re: [PHP-DEV] RFC karma for tdgroot

2021-06-03 Thread Nikita Popov
On Thu, Jun 3, 2021 at 3:02 PM Timon de Groot wrote: > I'm requesting RFC karma for my proposal in discussion '[PHP-DEV] > json_encode indent parameter'. > > For those interested in my public profile, please see my Github profile: > https://github.com/tdgroot. > > If you have any questions, pleas

[PHP-DEV] RFC karma for tdgroot

2021-06-03 Thread Timon de Groot
I'm requesting RFC karma for my proposal in discussion '[PHP-DEV] json_encode indent parameter'. For those interested in my public profile, please see my Github profile: https://github.com/tdgroot. If you have any questions, please let me know! -- Kind regads, Timon de Groot -- PHP Intern

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Guilliam Xavier
Hello, I have seen a similar discussion for var_export(), and the answer was basically "use a regex". E.g.: $json = preg_replace_callback( '/^(?: {4})+/m', fn ($m) => str_repeat($indent, strlen($m[0]) / 4), json_encode($data, JSON_PRETTY_PRINT) ); That said, I wou

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Jordi Boggiano
Hah, I sure did not expect my answer to trigger these 5 complex RFCs worth of work ;) On 03/06/2021 00:59, Mike Schinkel wrote: 4.) Given Nikita's comments on the O() performance of array_shift() have you considered instead simulating a FIFO queue using an array as a stack? Any reason tha

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Timon de Groot
On 3-6-2021 10:00, Jordi Boggiano wrote: I agree, but I'd make it accept a string|int much like JSON.stringify does, because that way you let people pass in tabs too, or "🚀" if that's how you want your JSON indented.. I like the idea of accepting string|int. Accepting string|int means a zval

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Timon de Groot
So if you do go ahead and make an RFC for this, I think my preference would be as a new parameter on json_encode accepting a positive integer. Thank your for your input, I'll start working on an RFC to introduce a new parameter for json_encode. -- PHP Internals - PHP Runtime Development Ma

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Lauri Kenttä
On 2021-06-03 01:59, Mike Schinkel wrote: 1.) Given Nikita's position that it would only be viable to offer a syntax that simulates method calling for arrays if the methods themselves are immutable can you envision a solution for allowing $array->shift() functionality that would address getting b

Re: [PHP-DEV] json_encode indent parameter

2021-06-03 Thread Jordi Boggiano
On 03/06/2021 02:45, David Gebler wrote: I would say though (a) is true enough but doesn't necessarily cover all use cases, adds more magic constants and doesn't provide equivalence to the JSON libraries of other common languages which permit for custom values, while (b) is less of an issue with