Skip to content

Commit

Permalink
Merge branch 'hotfix/6'
Browse files Browse the repository at this point in the history
Close #6
  • Loading branch information
michalbundyra committed May 10, 2019
2 parents d4054a6 + e14a15a commit d73bece
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ All notable changes to this project will be documented in this file, in reverse

- [#5](https://github.com/webimpress/coding-standard/pull/5) `Methods\LineAfterSniff` - fixes adding empty line after method when next content is doc-block

- [#6](https://github.com/webimpress/coding-standard/pull/6) `Commenting\Placement` - fixes false-positive when space was required before comment in next line after PHP open tag

## 1.0.0 - 2019-03-07

Initial release.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();

if ($tokens[$stackPtr - 1]['code'] !== T_WHITESPACE
if ($tokens[$stackPtr]['column'] !== 1
&& $tokens[$stackPtr - 1]['code'] !== T_WHITESPACE
&& ($tokens[$stackPtr - 1]['code'] !== T_COMMENT
|| $tokens[$stackPtr - 1]['line'] === $tokens[$stackPtr]['line'])
) {
Expand Down
1 change: 1 addition & 0 deletions test/Sniffs/Commenting/PlacementUnitTest.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
/* comment */

echo /* 1 */ 'hey';
echo 'world';// hey
Expand Down
1 change: 1 addition & 0 deletions test/Sniffs/Commenting/PlacementUnitTest.inc.fixed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
/* comment */

echo 'hey'; /* 1 */
echo 'world'; // hey
Expand Down
6 changes: 3 additions & 3 deletions test/Sniffs/Commenting/PlacementUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class PlacementUnitTest extends AbstractTestCase
protected function getErrorList(string $testFile = '') : array
{
return [
3 => 1,
4 => 1,
6 => 3,
8 => 3,
5 => 1,
7 => 3,
9 => 3,
];
}

Expand Down

0 comments on commit d73bece

Please sign in to comment.