Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting default value of typehinted argument to array using short array syntax in PHP #17

Closed
titoBouzout opened this issue Dec 22, 2014 · 2 comments

Comments

@titoBouzout
Copy link
Collaborator

From @marcushat on September 5, 2014 18:37

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):

<?php
function foo(array &$foobar= [] ) { //array literal gets highlighted
}

function foo(array &$foobar= array() ) { //this is fine
}

function foo(&$foobar= [] ) { //this is fine too
}
?>

Copied from original issue: sublimehq/sublime_text#470

gerardroche added a commit to gerardroche/sublime-php-grammar that referenced this issue Jan 8, 2015
Re: Setting default value of typehinted argument to array using short array syntax in PHP
gerardroche added a commit to gerardroche/sublime-php-grammar that referenced this issue Jan 8, 2015
* release/0.4.0:
  Update changelog
  Prepare release 0.4.0; Bump version
  📝 readme, docs, etc...
  Add support for PHP 5.4 __TRAIT__ magic constant
  Add PHP 5.4. trait support
  Add new PHP 5.5 yield keyword
  Add new PHP 5.5 finally keyword
  Auto disable native PHP package
  Fix jskinner/DefaultPackages#17 Typehinted short array arg syntax
  Rename indentation test file names
  Rename annex indentation rules file
@FichteFoll
Copy link
Contributor

Can not repro in 3104, but I don't know when it was fixed initially.

@marcushat
Copy link

Working on 3103 too. Must have been recently because I was still having this issue a couple weeks ago. Glad it's resolved now though

On Feb 17, 2016, at 7:39 PM, FichteFoll notifications@github.com wrote:

Can not repro in 3104, but I don't know when it was fixed initially.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants