Skip to content

Commit

Permalink
Renamed sniffs and tweaked error messages (ref #3055)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Jan 13, 2021
1 parent 998f1da commit 44a09f0
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
24 changes: 12 additions & 12 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="NestingLevelStandard.xml" role="php" />
</dir>
<dir name="NamingConventions">
<file baseinstalldir="PHP/CodeSniffer" name="AbstractPrefixRequiredForAbstractClassStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="AbstractClassNamePrefixStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="CamelCapsFunctionNameStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="ConstructorNameStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceSuffixRequiredForInterfaceStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitSuffixRequiredForTraitStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceNameSuffixStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitNameSuffixStandard.xml" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="UpperCaseConstantNameStandard.xml" role="php" />
</dir>
<dir name="PHP">
Expand Down Expand Up @@ -428,11 +428,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="NestingLevelSniff.php" role="php" />
</dir>
<dir name="NamingConventions">
<file baseinstalldir="PHP/CodeSniffer" name="AbstractPrefixRequiredForAbstractClassSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="AbstractClassNamePrefixSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="CamelCapsFunctionNameSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="ConstructorNameSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceSuffixRequiredForInterfaceSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitSuffixRequiredForTraitSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceNameSuffixSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitNameSuffixSniff.php" role="php" />
<file baseinstalldir="PHP/CodeSniffer" name="UpperCaseConstantNameSniff.php" role="php" />
</dir>
<dir name="PHP">
Expand Down Expand Up @@ -676,16 +676,16 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="NestingLevelUnitTest.php" role="test" />
</dir>
<dir name="NamingConventions">
<file baseinstalldir="PHP/CodeSniffer" name="AbstractPrefixRequiredForAbstractClassUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="AbstractPrefixRequiredForAbstractClassUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="AbstractClassNamePrefixUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="AbstractClassNamePrefixUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="CamelCapsFunctionNameUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="CamelCapsFunctionNameUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="ConstructorNameUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="ConstructorNameUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceSuffixRequiredForInterfaceUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceSuffixRequiredForInterfaceUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitSuffixRequiredForTraitUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitSuffixRequiredForTraitUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceNameSuffixUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="InterfaceNameSuffixUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitNameSuffixUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="TraitNameSuffixUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="UpperCaseConstantNameUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="UpperCaseConstantNameUnitTest.php" role="test" />
</dir>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<documentation title="Abstract class name">
<standard>
<![CDATA[
Abstract classes MUST be prefixed by Abstract: e.g. AbstractBar.
Abstract class names must be prefixed with "Abstract", e.g. AbstractBar.
]]>
</standard>
<code_comparison>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<documentation title="Interface name">
<documentation title="Interface name suffix">
<standard>
<![CDATA[
Interfaces MUST be suffixed by Interface: e.g. BarInterface.
Interface names must be suffixed with "Interface", e.g. BarInterface.
]]>
</standard>
<code_comparison>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<documentation title="Trait name">
<documentation title="Trait name suffix">
<standard>
<![CDATA[
Traits MUST be suffixed by Trait: e.g. BarTrait.
Trait names must be suffixed with "Trait", e.g. BarTrait.
]]>
</standard>
<code_comparison>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;

class AbstractPrefixRequiredForAbstractClassSniff implements Sniff
class AbstractClassNamePrefixSniff implements Sniff
{


Expand Down Expand Up @@ -51,7 +51,7 @@ public function process(File $phpcsFile, $stackPtr)

$prefix = substr($className, 0, 8);
if (strtolower($prefix) !== 'abstract') {
$phpcsFile->addError('Abstract classes MUST be prefixed by Abstract: e.g. AbstractBar. Found: %s', $stackPtr, 'Missing', [$className]);
$phpcsFile->addError('Abstract class names must be prefixed with "Abstract"; found "%s"', $stackPtr, 'Missing', [$className]);
}

}//end process()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;

class InterfaceSuffixRequiredForInterfaceSniff implements Sniff
class InterfaceNameSuffixSniff implements Sniff
{


Expand Down Expand Up @@ -45,7 +45,7 @@ public function process(File $phpcsFile, $stackPtr)

$suffix = substr($interfaceName, -9);
if (strtolower($suffix) !== 'interface') {
$phpcsFile->addError('Interfaces MUST be suffixed by Interface: e.g. BarInterface. Found: %s', $stackPtr, 'Missing', [$interfaceName]);
$phpcsFile->addError('Interface names must be suffixed with "Interface"; found "%s"', $stackPtr, 'Missing', [$interfaceName]);
}

}//end process()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;

class TraitSuffixRequiredForTraitSniff implements Sniff
class TraitNameSuffixSniff implements Sniff
{


Expand Down Expand Up @@ -45,7 +45,7 @@ public function process(File $phpcsFile, $stackPtr)

$suffix = substr($traitName, -5);
if (strtolower($suffix) !== 'trait') {
$phpcsFile->addError('Traits MUST be suffixed by Trait: e.g. BarTrait. Found: %s', $stackPtr, 'Missing', [$traitName]);
$phpcsFile->addError('Trait names must be suffixed with "Trait"; found "%s"', $stackPtr, 'Missing', [$traitName]);
}

}//end process()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Unit test class for the AbstractPrefixRequiredForAbstractClass sniff.
* Unit test class for the AbstractClassNamePrefix sniff.
*
* @author Anna Borzenko <annnechko@gmail.com>
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
Expand All @@ -10,7 +10,7 @@

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

class AbstractPrefixRequiredForAbstractClassUnitTest extends AbstractSniffUnitTest
class AbstractClassNamePrefixUnitTest extends AbstractSniffUnitTest
{


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Unit test class for the InterfaceSuffixRequiredForInterface sniff.
* Unit test class for the InterfaceNameSuffix sniff.
*
* @author Anna Borzenko <annnechko@gmail.com>
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
Expand All @@ -10,7 +10,7 @@

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

class InterfaceSuffixRequiredForInterfaceUnitTest extends AbstractSniffUnitTest
class InterfaceSuffixNameUnitTest extends AbstractSniffUnitTest
{


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Unit test class for the TraitSuffixRequiredForTrait sniff.
* Unit test class for the TraitNameSuffix sniff.
*
* @author Anna Borzenko <annnechko@gmail.com>
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
Expand All @@ -10,7 +10,7 @@

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

class TraitSuffixRequiredForTraitUnitTest extends AbstractSniffUnitTest
class TraitNameSuffixUnitTest extends AbstractSniffUnitTest
{


Expand Down

0 comments on commit 44a09f0

Please sign in to comment.