How to use `intelephense` to remove blank lines when format my php script in vs code?
Asked Answered
O

1

8

My system is centos 7.6,intelephense1.3.11,vs code 1.44.1

$options = array(  
PDO::ATTR_ERRMODE    => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false
);  
// Create a new PDO instanace  
$pdo= new PDO($dsn, $user, $pass, $options);  
$pdo->exec("set names utf8");




$groupsql = $pdo->query('SELECT * FROM lime_groups WHERE sid=' .$survey_id.' ORDER BY group_order');
$groupres = $groupsql->fetchAll(PDO::FETCH_ASSOC);

I just want to format my script by remove the blank line ,right indent.
As to above script,I ctrl+A,and then ctrl +shift +I,blank lines still there.
How to use intelephense to remove blank lines when format my php script in vs code?

Orthostichy answered 18/4, 2020 at 14:15 Comment(0)
P
1

This is because Intelephense does not support this. Also PSR-2/PSR-12 don't cover such lines, because they (believe it or not) can be intentional.

So you have only two options here:

  1. Add this as feature request issue on Github
  2. Use one of the many plugins that provide this functionally

P.S. the real reason why I answer this question: your application is highly vulnerable to SQL Injections as you don't escape the the parameters passed to your SQL query at all.

Phyllys answered 21/9, 2022 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.