Visual Studio Code PHP Intelephense auto formats Null Coalescing Operator

488 Views Asked by At

I'm using PHP Intelephense(free) extension in vscode and we use CodeIgniter 3 in our project and it works well with models and controller, but in my pages/view where javascript,css,jquery is written. Null Coalescing Operator happens to be auto formatting by PHP Intelephense by separating the questions (from ?? to ? ?) automatically. Is their no way to ignore this rule in PHP Intelephense?

  return data ?? '--';

when doing auto formatting (in mac) (option + shift + f) its turning into this which causes error.

  return data ? ? '--';
1

There are 1 best solutions below

0
On

I have made an alternative solution to my own problem. by adding a grave accent in the return then calling the expression inside a template literal.

return ${data ?? '--'}

Forcing the php Intelephense to ignore the said line.