Skip to content

Commit

Permalink
Squiz.WhiteSpace.LanguageConstructSpacing no longer checks for spaces…
Browse files Browse the repository at this point in the history
… if parenthesis are being used (request squizlabs#1062)
  • Loading branch information
gsherwood committed Jul 14, 2016
1 parent 7fd0eef commit e05973a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CodeSniffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PHP_CodeSniffer
*
* @var string
*/
const VERSION = '2.6.3';
const VERSION = '2.7.0';

/**
* Package stability; either stable, beta or alpha.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$phpcsFile->fixer->replaceToken(($stackPtr + 1), ' ');
}
}
} else {
} else if ($tokens[($stackPtr + 1)]['code'] !== T_OPEN_PARENTHESIS) {
$error = 'Language constructs must be followed by a single space; expected "%s" but found "%s"';
$data = array(
$tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
echo $blah;
echo $blah;
echo($blah);

print $blah;
print $blah;
print($blah);

include $blah;
include $blah;
include($blah);

include_once $blah;
include_once $blah;
include_once($blah);

require $blah;
require $blah;
require($blah);

require_once $blah;
require_once $blah;
require_once($blah);

$obj = new MyClass();
$obj = new MyClass();

return;
return $blah;
return $blah;
return($blah);
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,13 @@ public function getErrorList()
{
return array(
3 => 1,
4 => 1,
7 => 1,
8 => 1,
11 => 1,
12 => 1,
15 => 1,
16 => 1,
19 => 1,
20 => 1,
23 => 1,
24 => 1,
27 => 1,
31 => 1,
32 => 1,
);

}//end getErrorList()
Expand Down
7 changes: 5 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ http://pear.php.net/dtd/package-2.0.xsd">
<date>2016-07-14</date>
<time>09:28:00</time>
<version>
<release>2.6.3</release>
<api>2.6.3</api>
<release>2.7.0</release>
<api>2.7.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- Squiz.WhiteSpace.LanguageConstructSpacing no longer checks for spaces if parenthesis are being used (request #1062)
-- Makes this sniff more compatibile with those that check parenthesis spacing of function calls
- Fixed bug #1066 : Undefined index: quiet in CLI.php during unit test run with -v command line arg
</notes>
<contents>
Expand Down Expand Up @@ -2137,6 +2139,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
<file baseinstalldir="PHP" name="LanguageConstructSpacingUnitTest.inc" role="test" />
<file baseinstalldir="PHP" name="LanguageConstructSpacingUnitTest.inc.fixed" role="test" />
<file baseinstalldir="PHP" name="LanguageConstructSpacingUnitTest.php" role="test">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
Expand Down

0 comments on commit e05973a

Please sign in to comment.