-
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.
Improve handling of the stroustrup coding style
- Loading branch information
1 parent
a8056cd
commit e6b5a86
Showing
8 changed files
with
261 additions
and
128 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
SubmittyStandard/Sniffs/ControlStructures/DoWhileSniff.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,21 @@ | ||
<?php | ||
|
||
/** | ||
* Verifies that control statements conform to their coding standards. | ||
* | ||
* @author Matthew Peveler | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SubmittyStandard\Sniffs\ControlStructures; | ||
|
||
use PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ControlSignatureSniff; | ||
|
||
class DoWhileSniff extends ControlSignatureSniff { | ||
public function register() { | ||
return [ | ||
T_WHILE | ||
]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
do { | ||
} while (true); | ||
|
||
// do-while is special | ||
do { | ||
} | ||
while(true); |
18 changes: 18 additions & 0 deletions
18
SubmittyStandard/Tests/ControlStructures/DoWhileUnitTest.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,18 @@ | ||
<?php | ||
|
||
namespace SubmittyStandard\Tests\ControlStructures; | ||
|
||
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; | ||
|
||
class DoWhileUnitTest extends AbstractSniffUnitTest { | ||
public function getErrorList() { | ||
return [ | ||
8 => 1, | ||
9 => 1 | ||
]; | ||
} | ||
|
||
public function getWarningList() { | ||
return []; | ||
} | ||
} |
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
Oops, something went wrong.