Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm complains on simple use of array variables

Anyone know how to fix "Simple use of array variables" in BASH?

for instance:

# will complain $paths[@] is a simple array variable
for path in "${paths[@]}"; do 
    [ ! -d "${path}" ] && mkdir -p "${path}"
done

I have about 10 notices in my code I would like to take care of

like image 656
ehime Avatar asked Jan 11 '23 12:01

ehime


1 Answers

This looks like a bug in bashsupport for IDEA / PHPStorm / etc.

It seems that the code only checks for arithmetic expressions between the brackets, so paths[1+2] works but paths[@] does not as it is no arithmetic expression.

like image 98
nemo Avatar answered Jan 17 '23 19:01

nemo