Git Product home page Git Product logo

Comments (6)

julienfalque avatar julienfalque commented on June 18, 2024 1

I think I get your point, but then it looks like a small edge-case to me. I don't think we'll invest time on this so I'd suggest not using no_trailing_whitespace_in_string and maybe creating a custom rule.

from php-cs-fixer.

keradus avatar keradus commented on June 18, 2024

why a single whitespace is non-risky, while 2 whitespaces are risky?

from php-cs-fixer.

njake avatar njake commented on June 18, 2024

For later readability single space is better and it wont break if text is used as SQL command or exec commands ect.

Example using SQL in string

--- Original
+++ New
-<?php $a = 'SELECT    
-id  
-name                        
-address
+<?php $a = 'SELECT 
+id 
+name 
+address

from php-cs-fixer.

julienfalque avatar julienfalque commented on June 18, 2024

Why do you need to keep one space instead of removing all? What difference does it make for e.g. SQL?

from php-cs-fixer.

njake avatar njake commented on June 18, 2024

I'm just trying to make examples of how this could be improved if the coder has accidentally inserted unnecessary spaces.
I have lot of diffirent kind of legacy ugly code with those unnecessary spaces and it would be great if fixer could remove them without breaking world.

SQL parsing from parts. Not real life example.

$select = 'SELECT          '; // Can be trimmed down to one space.
$columns = '   
     id     
     name    
'; // Can be trimmed down to one space.
$where = 'WHERE '; // Broke SQL if space trimmed. So it needed to keep here.
$whereColumns = ' id=1';

from php-cs-fixer.

keradus avatar keradus commented on June 18, 2024

Agree.

Please continue with @julienfalque suggestion.

Thanks!

from php-cs-fixer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.