How to define variables in phpstorm

In my PHP project I'm using static-file server (ex img.domain.com). That server path I have is stored in

$config
table. (
$this->config['file_server']
).
During developement static server-file is local server (main root).
Problem is that when using it I don't get path suggestions (ctrl+space) eg:
<img src="<?=$this->config['file_server'];?>image.png">

Can I make phpstorm to interprate

$this->config['file_server']
as
"/"
sign?
0
2 comments

is there any solution??

0

Hi there,

You cannot.

  • The actual inspection is disabled in such situations on purpose (to avoid false warnings .. since it is unknown in advance what that path would be).
  • IDE currently does not allow to provide value or return type for individual array elements anyway


On another hand -- it works just fine if leading "/" is actually present, i.e.

<img src="<?=$this->config['file_server'];?>/image.png">
(in such case path completion works)

0

Please sign in to leave a comment.