Req #71057 [NEW]: var_export uses long array syntax, is not PSR-2 compliant

From: Date: Tue, 08 Dec 2015 11:20:01 +0000
Subject: Req #71057 [NEW]: var_export uses long array syntax, is not PSR-2 compliant
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197690@lists.php.net to get a copy of this message
From: marcus at synchromedia dot co dot uk Operating system: PHP version: 5.6.16 Package: Arrays related Bug Type: Feature/Change Request Bug description:var_export uses long array syntax, is not PSR-2 compliant Description: ------------ Calling var_export with an array parameter generates PHP code that uses old-style long array syntax instead of PHP 5.4-style short array syntax. There are also some spacing issues that mean that the generated code is not PSR-2 compliant (space after 'array' and 2-space indenting), and I don't see any good reason for that not to be the case. It appears that this behaviour occurs in all versions since PHP 5.4, including 7. Test script: --------------- var_export(['a' => 0]); Expected result: ---------------- [ 'a' => 0, ] Actual result: -------------- array ( 'a' => 0, ) -- Edit bug report at https://bugs.php.net/bug.php?id=71057&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71057&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71057&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71057&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71057&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71057&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71057&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71057&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71057&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71057&r=support Expected behavior: https://bugs.php.net/fix.php?id=71057&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71057&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71057&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71057&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71057&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71057&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71057&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71057&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71057&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71057&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71057&r=mysqlcfg

« previous php.bugs (#197690) next »