diff --git a/Symfony/Sniffs/NamingConventions/ValidClassNameSniff.php b/Symfony/Sniffs/NamingConventions/ValidClassNameSniff.php index 2212248..c26ab33 100644 --- a/Symfony/Sniffs/NamingConventions/ValidClassNameSniff.php +++ b/Symfony/Sniffs/NamingConventions/ValidClassNameSniff.php @@ -49,10 +49,7 @@ class ValidClassNameSniff implements Sniff public function register() { return array( - T_INTERFACE, - T_TRAIT, T_EXTENDS, - T_ABSTRACT ); } @@ -72,38 +69,6 @@ public function process(File $phpcsFile, $stackPtr) while ($tokens[$stackPtr]['line'] === $line) { - /* - * Suffix interfaces with Interface; - */ - if ('T_INTERFACE' === $tokens[$stackPtr]['type']) { - $name = $phpcsFile->findNext(T_STRING, $stackPtr); - - if ($name && substr($tokens[$name]['content'], -9) !== 'Interface') { - $phpcsFile->addError( - 'Interface name is not suffixed with "Interface"', - $stackPtr, - 'InvalidInterfaceName' - ); - } - break; - } - - /* - * Suffix traits with Trait; - */ - if ('T_TRAIT' === $tokens[$stackPtr]['type']) { - $name = $phpcsFile->findNext(T_STRING, $stackPtr); - - if ($name && substr($tokens[$name]['content'], -5) !== 'Trait') { - $phpcsFile->addError( - 'Trait name is not suffixed with "Trait"', - $stackPtr, - 'InvalidTraitName' - ); - } - break; - } - /* * Suffix exceptions with Exception; */ @@ -129,26 +94,6 @@ public function process(File $phpcsFile, $stackPtr) } break; } - - /* - * Prefix abstract classes with Abstract. - */ - if ('T_ABSTRACT' === $tokens[$stackPtr]['type']) { - $name = $phpcsFile->findNext(T_STRING, $stackPtr); - $function = $phpcsFile->findNext(T_FUNCTION, $stackPtr); - - // making sure we're not dealing with an abstract function - if ((null === $function|| $name < $function) - && strpos($tokens[$name]['content'], 'Abstract') !== 0 - ) { - $phpcsFile->addError( - 'Abstract class name is not prefixed with "Abstract"', - $stackPtr, - 'InvalidAbstractName' - ); - } - break; - } } } } diff --git a/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.inc b/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.inc index b8d6588..f9b3d99 100644 --- a/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.inc +++ b/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.inc @@ -3,18 +3,3 @@ class Foo extends \Exception {} class FooException extends \Exception {} - -abstract class Bar { - function __construct() {} - -} - -abstract class AbstractBar {} - -trait Baz {} - -trait BazTrait {} - -interface Qux {} - -interface QuxInterface {} \ No newline at end of file diff --git a/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.php b/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.php index fef39bf..8fdc59c 100644 --- a/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.php +++ b/Symfony/Tests/NamingConventions/ValidClassNameUnitTest.php @@ -44,9 +44,6 @@ public function getErrorList() { return array( 3 => 1, - 7 => 1, - 14 => 1, - 18 => 1, ); } diff --git a/Symfony/ruleset.xml b/Symfony/ruleset.xml index 4ef6dc5..9c8d36c 100755 --- a/Symfony/ruleset.xml +++ b/Symfony/ruleset.xml @@ -24,6 +24,9 @@ + + + diff --git a/composer.json b/composer.json index b6817e0..143132f 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "issues": "https://github.com/djoos/Symfony-coding-standard/issues" }, "require": { - "squizlabs/php_codesniffer": "^3.3.1" + "squizlabs/php_codesniffer": "^3.6.0" }, "require-dev": { "phpunit/phpunit": "^5.0 || ^6.0 || ^7.0"