Re: [PHP-DEV] var_export() array format

2018-02-17 Thread Paul Jones
> On Feb 17, 2018, at 18:27, Andreas Hennings wrote: > > What we can do is add a third parameter with flags. Big +1. When writing tests and setting the $expected value, one of the constantly recurring drudgeries is reformatting the correct var_export($actual) output from arrays to match the

Re: [PHP-DEV] var_export() array format

2018-02-17 Thread Andreas Hennings
On 18 February 2018 at 02:04, David Rodrigues wrote: > I just think that is not responsability of PHP to care about output format > at core level (although we have the json pretty output support...). Why not? E.g. JSON_PRETTY_PRINT is something I use a lot, often in situations where I don't or ca

Re: [PHP-DEV] var_export() array format

2018-02-17 Thread David Rodrigues
I just think that is not responsability of PHP to care about output format at core level (although we have the json pretty output support...). Maybe you can found some solution with packages. Em 17 de fev de 2018 10:28 PM, "Andreas Hennings" escreveu: > I sometimes use var_export() to export a

[PHP-DEV] var_export() array format

2018-02-17 Thread Andreas Hennings
I sometimes use var_export() to export a structured array and then copy+paste it into my code. And sometimes I use it as part of an automatic code generator. Unfortunately, the output is usually not in the format that I want, or that is common for most projects / code styles. - Indentation is 2 s

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-17 Thread Rowan Collins
On 8 February 2018 18:38:36 GMT+00:00, Mcmuffin Mcguffin wrote: >Hi, > >It's a common idiom in object-oriented languages to create an object >and >then immediately call a method on it, such as (in C# or Java): > >new DateTime ().ToString () > >However, PHP grammar does not work this way. This wo

Re: [PHP-DEV] Suggested change: change priority of new and ->

2018-02-17 Thread Mcmuffin Mcguffin
> > Is that creating an instance of the class name stored in the 0th index of > the array $var or is it creating an instance of the class name stored in > $var and accessing the 0th index using ArrayAccess? > As soon as $var gets involved, it should be prioritized above the new operator. So it's e