diff --git a/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniff.php b/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniff.php
deleted file mode 100644
index cd5d46e..0000000
--- a/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniff.php
+++ /dev/null
@@ -1,75 +0,0 @@
-getTokens();
-
- $token = $tokens[$stackPtr];
- if (empty($token['scope_opener'])) {
- return;
- }
-
- $openerIndex = $token['scope_opener'];
- $openerToken = $tokens[$openerIndex];
-
- $fixable = false;
- if ($openerToken['code'] === T_COLON) {
- $fixable = true;
- }
-
- if (!$fixable) {
- $phpcsFile->addError('Alternative control structure syntax should not be used', $openerIndex, 'AlternativeForbidden');
-
- return;
- }
-
- $fix = $phpcsFile->addFixableError('Alternative control structure syntax should not be used', $openerIndex, 'AlternativeForbidden');
- if (!$fix) {
- return;
- }
-
- $nextPtr = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true);
- $semicolonPtr = null;
- if ($nextPtr && $tokens[$nextPtr]['code'] === T_SEMICOLON) {
- $semicolonPtr = $nextPtr;
- }
-
- $phpcsFile->fixer->beginChangeset();
-
- $phpcsFile->fixer->replaceToken($stackPtr, '}');
- if ($semicolonPtr) {
- $phpcsFile->fixer->replaceToken($semicolonPtr, '');
- }
-
- $phpcsFile->fixer->replaceToken($openerIndex, '{');
-
- $phpcsFile->fixer->endChangeset();
- }
-}
diff --git a/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniff.php b/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniff.php
deleted file mode 100644
index c507b6e..0000000
--- a/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniff.php
+++ /dev/null
@@ -1,122 +0,0 @@
-getTokens();
-
- $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
- if (!$next) {
- return;
- }
- $this->checkNext($phpcsFile, $stackPtr, $next);
-
- $previous = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
- if (!$previous) {
- return;
- }
-
- if ($tokens[$previous]['code'] !== T_WHITESPACE && ($previous !== $stackPtr - 1)) {
- if ($tokens[$previous]['code'] === T_COMMA) {
- return;
- }
-
- $error = 'Space before comma, expected none, though';
-
- $prevIndex = $phpcsFile->findPrevious(Tokens::$emptyTokens, $previous, null, true);
- if (!$prevIndex) {
- $phpcsFile->addError($error, $next, 'InvalidCommaBefore');
-
- return;
- }
-
- $fix = $phpcsFile->addFixableError($error, $next, 'InvalidCommaBefore');
- if ($fix) {
- $phpcsFile->fixer->beginChangeset();
-
- $content = $tokens[$prevIndex]['content'];
- $phpcsFile->fixer->replaceToken($prevIndex, $content . ',');
- $phpcsFile->fixer->replaceToken($stackPtr, '');
-
- $nextIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
- if ($nextIndex) {
- for ($i = $stackPtr + 1; $i < $nextIndex; $i++) {
- $phpcsFile->fixer->replaceToken($i, '');
- }
- }
-
- $phpcsFile->fixer->endChangeset();
- }
- }
- }
-
- /**
- * @param \PHP_CodeSniffer\Files\File $phpcsFile
- * @param int $stackPtr
- * @param int $next
- *
- * @return void
- */
- public function checkNext(File $phpcsFile, int $stackPtr, int $next): void
- {
- $tokens = $phpcsFile->getTokens();
-
- // Closing inline array should not have a comma before
- if ($tokens[$next]['code'] === T_CLOSE_SHORT_ARRAY && $tokens[$next]['line'] === $tokens[$stackPtr]['line']) {
- $error = 'Invalid comma before closing inline array end `]`.';
- $fix = $phpcsFile->addFixableError($error, $next, 'InvalidCommaInline');
- if ($fix) {
- $phpcsFile->fixer->replaceToken($stackPtr, '');
- }
-
- return;
- }
-
- if ($tokens[$next]['code'] !== T_WHITESPACE && ($next !== $stackPtr + 2)) {
- // Last character in a line is ok.
- if ($tokens[$next]['line'] !== $tokens[$stackPtr]['line']) {
- return;
- }
-
- // Closing inline array is also ignored
- if (in_array($tokens[$next]['code'], [T_CLOSE_SHORT_ARRAY, T_CLOSE_PARENTHESIS], true)) {
- return;
- }
-
- $error = 'Missing space after comma';
- $fix = $phpcsFile->addFixableError($error, $next, 'MissingCommaAfter');
- if ($fix) {
- $phpcsFile->fixer->addContent($stackPtr, ' ');
- }
- }
- }
-}
diff --git a/PhpCollective/ruleset.xml b/PhpCollective/ruleset.xml
index a0bc71e..724fcc4 100644
--- a/PhpCollective/ruleset.xml
+++ b/PhpCollective/ruleset.xml
@@ -251,6 +251,8 @@
+
+
diff --git a/docs/sniffs.md b/docs/sniffs.md
index f80f9c1..3adcf0b 100644
--- a/docs/sniffs.md
+++ b/docs/sniffs.md
@@ -48,7 +48,7 @@ PEAR (4 sniffs)
- PEAR.Functions.ValidDefaultValue
- PEAR.NamingConventions.ValidClassName
-PhpCollective (87 sniffs)
+PhpCollective (85 sniffs)
-------------------------
- PhpCollective.Arrays.ArrayBracketSpacing
- PhpCollective.Arrays.DisallowImplicitArrayCreation
@@ -97,7 +97,6 @@ PhpCollective (87 sniffs)
- PhpCollective.ControlStructures.ControlSignature
- PhpCollective.ControlStructures.ControlStructureEmptyStatement
- PhpCollective.ControlStructures.ControlStructureSpacing
-- PhpCollective.ControlStructures.DisallowAlternativeControlStructures
- PhpCollective.ControlStructures.DisallowCloakingCheck
- PhpCollective.ControlStructures.ElseIfDeclaration
- PhpCollective.ControlStructures.NoInlineAssignment
@@ -123,7 +122,6 @@ PhpCollective (87 sniffs)
- PhpCollective.Testing.AssertPrimitives
- PhpCollective.Testing.ExpectException
- PhpCollective.Testing.Mock
-- PhpCollective.WhiteSpace.CommaSpacing
- PhpCollective.WhiteSpace.ConcatenationSpacing
- PhpCollective.WhiteSpace.ConsistentIndent
- PhpCollective.WhiteSpace.DocBlockSpacing
@@ -270,7 +268,7 @@ Squiz (27 sniffs)
- Squiz.WhiteSpace.SemicolonSpacing
- Squiz.WhiteSpace.SuperfluousWhitespace
-Universal (10 sniffs)
+Universal (12 sniffs)
---------------------
- Universal.CodeAnalysis.ConstructorDestructorReturn
- Universal.CodeAnalysis.ForeachUniqueAssignment
@@ -278,9 +276,11 @@ Universal (10 sniffs)
- Universal.CodeAnalysis.StaticInFinalClass
- Universal.Constants.LowercaseClassResolutionKeyword
- Universal.Constants.UppercaseMagicConstants
+- Universal.ControlStructures.DisallowAlternativeSyntax
- Universal.Operators.ConcatPosition
- Universal.Operators.TypeSeparatorSpacing
- Universal.UseStatements.NoUselessAliases
+- Universal.WhiteSpace.CommaSpacing
- Universal.WhiteSpace.PrecisionAlignment
Zend (1 sniff)
diff --git a/tests/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniffTest.php b/tests/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniffTest.php
deleted file mode 100644
index 1b7301e..0000000
--- a/tests/PhpCollective/Sniffs/ControlStructures/DisallowAlternativeControlStructuresSniffTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-assertSnifferFindsErrors(new DisallowAlternativeControlStructuresSniff(), 5);
- }
-
- /**
- * @return void
- */
- public function testDocBlockConstFixer(): void
- {
- $this->assertSnifferCanFixErrors(new DisallowAlternativeControlStructuresSniff());
- }
-}
diff --git a/tests/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniffTest.php b/tests/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniffTest.php
deleted file mode 100644
index 8a4902f..0000000
--- a/tests/PhpCollective/Sniffs/WhiteSpace/CommaSpacingSniffTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-assertSnifferFindsErrors(new CommaSpacingSniff(), 2);
- }
-
- /**
- * @return void
- */
- public function testDocBlockConstFixer(): void
- {
- $this->assertSnifferCanFixErrors(new CommaSpacingSniff());
- }
-}
diff --git a/tests/_data/CommaSpacing/after.php b/tests/_data/CommaSpacing/after.php
deleted file mode 100644
index 7b84b0b..0000000
--- a/tests/_data/CommaSpacing/after.php
+++ /dev/null
@@ -1,18 +0,0 @@
- '/',
- //, __('Preferences') => array('url' => '/preferences/index')
- 'Key' => ['value'],
- __('Alerts') => ['url' => '/alerts/index'],
- ];
- }
-}
diff --git a/tests/_data/CommaSpacing/before.php b/tests/_data/CommaSpacing/before.php
deleted file mode 100644
index fe1821d..0000000
--- a/tests/_data/CommaSpacing/before.php
+++ /dev/null
@@ -1,18 +0,0 @@
- '/'
- //, __('Preferences') => array('url' => '/preferences/index')
- , 'Key' => ['value']
- , __('Alerts') => ['url' => '/alerts/index'],
- ];
- }
-}
diff --git a/tests/_data/DisallowAlternativeControlStructures/after.php b/tests/_data/DisallowAlternativeControlStructures/after.php
deleted file mode 100644
index e2aaef5..0000000
--- a/tests/_data/DisallowAlternativeControlStructures/after.php
+++ /dev/null
@@ -1,31 +0,0 @@
-setDirty('name', true);
- $usecasesTable->save($usecase);
- }
-
- if ($usecase) {
- $usecasesTable->save();
- }
-
- while ($x < 0) {
- $usecasesTable->save();
- $x--;
- }
-
- switch ($foo) {
- case 1:
- $usecasesTable->save();
- }
-
- for ($i < 0; $i--) {
- $usecasesTable->save();
- }
- }
-}
diff --git a/tests/_data/DisallowAlternativeControlStructures/before.php b/tests/_data/DisallowAlternativeControlStructures/before.php
deleted file mode 100644
index 9c9c866..0000000
--- a/tests/_data/DisallowAlternativeControlStructures/before.php
+++ /dev/null
@@ -1,31 +0,0 @@
-setDirty('name', true);
- $usecasesTable->save($usecase);
- endforeach;
-
- if ($usecase) :
- $usecasesTable->save();
- endif;
-
- while ($x < 0) :
- $usecasesTable->save();
- $x--;
- endwhile;
-
- switch ($foo) :
- case 1:
- $usecasesTable->save();
- endswitch;
-
- for ($i < 0; $i--) :
- $usecasesTable->save();
- endfor;
- }
-}