Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:106674
Return-Path: <vamakin@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 14426 invoked from network); 20 Aug 2019 20:34:48 -0000
Received: from unknown (HELO mail-ot1-f44.google.com) (209.85.210.44)
  by pb1.pair.com with SMTP; 20 Aug 2019 20:34:48 -0000
Received: by mail-ot1-f44.google.com with SMTP id e12so5877599otp.10
        for <internals@lists.php.net>; Tue, 20 Aug 2019 11:05:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:from:date:message-id:subject:to;
        bh=2bolUXxLub3DoBpG+JauSvLyEJ8/2DrJGdeQid6fnGA=;
        b=GQQCxTUkpMCU5U83PLZodf36mt8ImBfnRTS93oH/3/EP7QKOUg5J6KIrjVWKks+jkA
         Z1gxarth8eEL79UpQ0FxR9ojoHW1awCrAiAJLzjRdBcyT9jS0tAZKbOTj+ciP/sCqwYL
         iYxQYGuFywkvnAgVKLhsyjel25c89aIInR7fwkvyTleDIvyvkIg2Z/YleFvMeQ+gZjO7
         dcWcEO0OqiXp+h9CB2guSD74X28wchM3+4ASlDWzWhKQEGpSY/0xWmk6GUHs8nacfQHW
         X7BzgNKg+48xSWGXI3EamR829gduB0oeK0vOp49txQhdkNGPUBE9jWlxHbIFNM4yRcNV
         AOUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
        bh=2bolUXxLub3DoBpG+JauSvLyEJ8/2DrJGdeQid6fnGA=;
        b=fFvtTfJne5humPbrlusTqfskPz4LtPJBed7/ts2g/5k1I19AhkTYMQPVQ7QHNqEc+d
         u1JRhITyuEAwSNJDLcO6siyI6hzAPT4mXXnK7HcJOdqlStSiFE6QMTc4PBqjcrcEzup1
         hdf9+R+ioaFp1Dhv7uHOHv7IwUf9/ZwF258EeTgzzaornFymVvjP1SbxRXinmc8SRp47
         XcNcMpX4++eAtUO/ZY6r9LJNFrHgivfEj8ICIAnOXMi5FK6x3PGG5zKYb2H4N37pw3dy
         2IkoB/gkYCsjJWD1cNr2T4qYo8K9OXQQHN1XR6mQbddMv5n4+FW2hPyhBr9OY4WufzkH
         TWoQ==
X-Gm-Message-State: APjAAAVv6xRok2E2Lbna0DymxsZ5tHgHVDD61QwPHdELGdZNZf+1wWKR
	svksaHybyWpo31aUV1OTaRwJDmEzvfoSvU4NhNdYm4H/
X-Google-Smtp-Source: APXvYqztizuM56kESG+3xbBIlRC1hWYwEhSMQrPQpG3Cp/LHfr0sDyx83MxG2lAE3CPHp3e72+GhFpDJhF7qY+WVxY4=
X-Received: by 2002:a9d:6a4a:: with SMTP id h10mr13717033otn.260.1566324299715;
 Tue, 20 Aug 2019 11:04:59 -0700 (PDT)
MIME-Version: 1.0
Date: Tue, 20 Aug 2019 21:04:50 +0300
Message-ID: <CADrJwbmcj_vpb3_diQpP6eJ-Q2pBMf4wOv4eUf=iqjAWK2WbAg@mail.gmail.com>
To: internals@lists.php.net
Content-Type: multipart/alternative; boundary="0000000000007cdc0c0590904bdc"
Subject: RFC: var_export - short syntax for array
From: vamakin@gmail.com (=?UTF-8?B?0JLQu9Cw0LQg0JzQsNC60LjQvQ==?=)

--0000000000007cdc0c0590904bdc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello!

I would like to propose a little change in var_export function behavior.
For today, this function returns string representation of array in old
style with =E2=80=9Carray=E2=80=9D keyword:

var_export([]); // array()

I think it would be better if the function returned array representation in
modern square brackets syntax:

var_export([]); // []

I think now is good time for this change because short syntax is common and
used by almost all linters as well as in examples in code standards like
PSR-2 and PSR-12.

Also this change will make it easier in the future to remove old long
syntax from PHP.

I have already implemented the concept of this feature localy (here is the
diif
<https://github.com/php/php-src/compare/master...Zlob:modernize_var_export_=
function>).
As you can see, it does not affect a lot of the code.


This change does not break backward compability, becuse it steel returns
valid PHP array. But if it needed, this behaviour can be managed by an
additional optional function parametr.


Looking forward for your comments and suggestions

Sincerely,
Vladislav Makin

--0000000000007cdc0c0590904bdc--