|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-02-08 21:38 UTC] php at paulisageek dot com
Description:
------------
In our code we require everyone to put a trailing , in array declarations so that
blame stays clean. Like when:
$foo = array(
1,
)
becomes
$foo = array(
1,
2,
)
Then only 1 line has changed. But for function calls, when
$foo = foo(
1
)
becomes
$foo = foo(
1,
2
)
now 2 lines blame to you.
Allowing the same syntax for function calls as array creation would be great.
Test script:
---------------
<?php
function id($x) { return $x; }
id(1,);
Expected result:
----------------
It runs.
Actual result:
--------------
Fatal error: syntax error, unexpected ')'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
Not only function calls could work this way for a smoother workflow, methods and functions definitions also : function my_funtion($param1, $param2,) { // ... } Especially with a lot of parameters : function my_funtion( $param1, $param2, ..., $paramN, ) { // ... }