You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ST3 there is an issue with the php syntax definition. When defining the default value of an argument using the short array syntax([ ]) it highlights the array literal as invalid. It doesn't do this when using array() instead or without typehinting the argument. Ran the code and no errors or warnings and it works as expected. Only tested on current build 3065 of ST3.
Example(code used when I discovered this):
<?phpfunctionfoo(array &$foobar= [] ) { //array literal gets highlighted
}
functionfoo(array &$foobar= array() ) { //this is fine
}
functionfoo(&$foobar= [] ) { //this is fine too
}
?>
The text was updated successfully, but these errors were encountered:
marcushat
changed the title
setting default value of argument to array using short array syntax in PHP
Setting default value of typehinted argument to array using short array syntax in PHP
Sep 5, 2014
In ST3 there is an issue with the php syntax definition. When defining the default value of an argument using the short array syntax(
[ ]
) it highlights the array literal as invalid. It doesn't do this when usingarray()
instead or without typehinting the argument. Ran the code and no errors or warnings and it works as expected. Only tested on current build 3065 of ST3.Example(code used when I discovered this):
The text was updated successfully, but these errors were encountered: