aik099 / CodingStandard

The PHP_CodeSniffer coding standard I'm using on all of my projects
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

The "ConcatenationSpacingSniff" should validate extra spaces #20

Closed aik099 closed 9 years ago

aik099 commented 10 years ago

Right now "ConcatenationSpacingSniff" sniff validates, that at least one space is used to concatenate parts of a string. We should change it to be exactly one space.

In case if previous/next string ends up on another line we shouldn't validate other half:

// check both spaces
$s1 = 'a' . 'b';

// only check space before dot
$s2 = 'a' .
'b';

// only check space after dot
$s3 = 'a'
. 'b';

File: https://github.com/aik099/CodingStandard/blob/master/CodingStandard/Sniffs/Strings/ConcatenationSpacingSniff.php

aik099 commented 10 years ago

Currently new line symbols and indentation tabs appear as spaces in comparison and all seems valid.