-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow empty function unless adding a comment
- Loading branch information
Showing
10 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/Sniffs/Slevomat/Functions/DisallowEmptyFunctionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Ptscs\Tests\Sniffs\Slevomat\Functions; | ||
|
||
use Iterator; | ||
use Ptscs\Tests\SniffTestCase; | ||
use Ptscs\Tests\Utils\ErrorData; | ||
|
||
final class DisallowEmptyFunctionTest extends SniffTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->appendExclude('Squiz.Classes.ClassFileName.NoMatch'); | ||
} | ||
|
||
public static function provideTestData(): Iterator | ||
{ | ||
yield[ | ||
[new ErrorData(3, 'SlevomatCodingStandard.Functions.DisallowEmptyFunction.EmptyFunction')], | ||
]; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/Sniffs/Slevomat/Functions/_data/DisallowEmptyFunction.php.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
function emptyFunction() | ||
{ | ||
} | ||
|
||
function allowed() | ||
{ | ||
// allowed | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/Sniffs/Slevomat/Functions/_data/DisallowEmptyFunction.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
function emptyFunction() | ||
{ | ||
} | ||
|
||
function allowed() | ||
{ | ||
// allowed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ final class Foobar | |
{ | ||
public function check(string $useless, array $list, $missing): void | ||
{ | ||
// empty | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ final class Foobar | |
*/ | ||
public function check(string $useless, array $list, $missing): void | ||
{ | ||
// empty | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters