Need help getting a couple of settings right...

Hi guys,

Just evaluating your latest version (5.01), created a project and tweaked as many settings as I could find, but a few things seem to be eluding me.

------------
1) Several php functions seem not to be highlighted correctly in my project. With a quick skim over my code some of these are:

json_encode
json_decode
json_last_error
date_default_timezone_get
date_default_timezone_set
get_called_class
get_call_stack
spl_autoload_register
set_exception_handler (set error_handler is fine!)

and I'm sure there are many others. They are highlighted as "Identifiers" rather than "Predefined symbols". Is there something I need to do to get these to highlight correctly?

------------
2) Code completion is in general great, but classes instantiated from variables do not gain this treatment despite the code being perfectly acceptable. For example:

$model_class  = 'My_Model';
$model  = new $model_class();
$page    = $model->get_page();

does not work correctly, but:

$model  = new My_Model();
$page    = $model->get_page();

does. In the top case $model is not used correctly and get_page is highlighted as an error. The same is true for static calls:

$string  = 'My_String';
$string::blah('whatever');

does not work, but:

My_String::blah('whatever');

does. In the top case $string is treated like a string even after the "::" where I would have assumed the IDE parser would have been triggered and the "My_String" class used. Instead the blah method is incorrectly highlighted as an error.

I've not tested it, but I'd imagine the same is true for method calls from variables.

------------
3) Is it possible to colour objects differently from normal variables? It's not a big deal, but would be a nice to have. Same for method calls. For example see the colouring I used above... I've had a look, but I can't seem to find an option for this. It'd be cool to be able to do the same for arrays too.

Any advice is appreciated!

Cheers,

Paul

1 comment
Comment actions Permalink

Hi Paul,

1) Yes, there are much more standard functions that do not get coloured that way and there is no file or some sort of dialog window where you can enter such function names.

If you want -- you can file a new ticket on Issue Tracker with a list of such functions (this is very minor issue and I do not expect this to be addressed any time soon).

2) PhpStorm currently can evaluate values of most constants (since they usually defined with plain text value) but not variables (for various reasons, mainly performance and memory consumption, I would guess).

In current versions of PhpStorm you will need to use simple PHPDoc comment to tell what the final variable type is if you want to use such approach, e.g.

$model_class = 'My_Model';
$model = new $model_class();
$page = $model->get_page();
/** @var My_Model $page */

Maybe future versions will have improvements in such simple cases (but then -- why would you need an intermediate variable in such simple case). Please check Issue Tracker and feel free to submit new ticket if no existing ticket is found.

In case we are talking about some sort of factory pattern approach, then you may be interested in this ticket: http://youtrack.jetbrains.com/issue/WI-6027

3) All possible stylers are already listed in "Settings | Editor | Colors & Fonts | PHP". For me this is enough (I do not like rainbow before my eyes).

I remember seeing one or two tickets in this regard: http://youtrack.jetbrains.com/issue/WI-137 etc...  If you need more -- feel free to submit Feature Request ticket(s) to the Issue Tracker.

0

Please sign in to leave a comment.