Skip to content

Commit af4a20c

Browse files
committed
Remove usage of phpcsstandards packages
This reverts commit e6b5a86. Signed-off-by: Matthew Peveler <[email protected]>
1 parent aa41798 commit af4a20c

File tree

8 files changed

+411
-342
lines changed

8 files changed

+411
-342
lines changed

SubmittyStandard/Sniffs/ControlStructures/DoWhileSniff.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

SubmittyStandard/Sniffs/ControlStructures/StroustrupStructureSniff.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,31 @@
1010

1111
namespace SubmittyStandard\Sniffs\ControlStructures;
1212

13-
use PHPCSExtra\Universal\Sniffs\ControlStructures\IfElseDeclarationSniff;
13+
use PHP_CodeSniffer\Sniffs\AbstractPatternSniff;
1414

15-
class StroustrupStructureSniff extends IfElseDeclarationSniff {
16-
public function register() {
15+
class StroustrupStructureSniff extends AbstractPatternSniff {
16+
// phpcs:disable SubmittyStandard.NamingConventions.ValidVariableName.MemberNotSnakeCase
17+
/**
18+
* If true, comments will be ignored if they are found in the code.
19+
*
20+
* @var boolean
21+
*/
22+
public $ignoreComments = true;
23+
// phpcs: enable
24+
25+
protected function getPatterns() {
1726
return [
18-
\T_ELSE,
19-
\T_ELSEIF,
20-
\T_CATCH
27+
'do {EOL...} while (...);EOL',
28+
'while (...) {EOL',
29+
'for (...) {EOL',
30+
'if (...) {EOL',
31+
'foreach (...) {EOL',
32+
'}EOLelse if (...) {EOL',
33+
'}EOLelseif (...) {EOL',
34+
'}EOLelse {EOL',
35+
'do {EOL',
36+
'try {EOL',
37+
'}EOLcatch (...) {EOL'
2138
];
2239
}
2340
}

SubmittyStandard/Tests/ControlStructures/DoWhileUnitTest.inc

Lines changed: 0 additions & 9 deletions
This file was deleted.

SubmittyStandard/Tests/ControlStructures/DoWhileUnitTest.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

SubmittyStandard/Tests/ControlStructures/StroustrupStructureUnitTest.inc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ elseif (false) {
1313
else {
1414
}
1515

16+
do {
17+
} while (true);
18+
19+
// do-while is special
20+
do {
21+
}
22+
while(true);
23+
1624
try {
1725
} catch ($exc) {
1826
}
@@ -26,3 +34,10 @@ try
2634
{
2735
} catch (exc) {
2836
}
37+
38+
try
39+
{
40+
}
41+
catch (exc)
42+
{
43+
}

SubmittyStandard/Tests/ControlStructures/StroustrupStructureUnitTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ public function getErrorList() {
1010
4 => 1,
1111
5 => 1,
1212
6 => 1,
13-
17 => 1,
14-
27 => 1
13+
20 => 1,
14+
25 => 1,
15+
33 => 1,
16+
35 => 1,
17+
38 => 1,
18+
41 => 1
1519
];
1620
}
1721

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"require": {
77
"php": ">=7.1",
88
"squizlabs/php_codesniffer": "^3.5.4",
9-
"slevomat/coding-standard": "^6.1",
10-
"phpcsstandards/phpcsutils": "dev-develop",
11-
"phpcsstandards/phpcsextra": "dev-develop"
9+
"slevomat/coding-standard": "^6.1"
1210
},
1311
"config": {
1412
"platform": {
@@ -18,10 +16,10 @@
1816
"require-dev": {
1917
"pcov/clobber": "^2.0",
2018
"phpunit/phpunit": "^7.5.12",
21-
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2"
19+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
2220
},
2321
"suggest": {
24-
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
22+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
2523
},
2624
"autoload": {
2725
"psr-4": {

0 commit comments

Comments
 (0)