Aptana marks $a = [..] as a syntax error
Asked Answered
A

1

5

I'm using Aptana Studio 3 and I have the following problem:

When I type:

$return = ['success' => (validation_errors() == null) ? true : false];

Aptana marks this line as a syntax error. Any ideas on how to fix this?

Araroba answered 8/12, 2014 at 13:55 Comment(0)
F
15

Set your PHP version in Aptana to >=5.4. The array syntax with [] instead of array() is relatively new and depending on the parser it will show you a syntax error or not.

Right click on your project and go to Properties. Then click the "PHP Development" menu on the left, and select "PHP 5.4.x" (or something similar)

Fugacious answered 8/12, 2014 at 13:56 Comment(4)
that was fast... Thanks !Araroba
Quick correction (unless Aptana has it wrong): short array syntax was introduced in PHP 5.4, not 5.5.Hazzard
I tried and it is restoring back to 5.3 I even changed the file "PATH_TO_PROJECT/.settings/com.aptana.editor.php.prefs" with the following content: eclipse.preferences.version=1 phpVersion=php5.4 But no use .. any lead on this how to approachDefunct
@stackup same here, I change it to 5.4 and it goes back to 5.3, did you manage to change it?Springwood

© 2022 - 2024 — McMap. All rights reserved.